Re: Nepal 2016 DHS and CDC values [message #15639 is a reply to message #14640] |
Mon, 27 August 2018 11:48 |
Liz-DHS
Messages: 1516 Registered: February 2013
|
Senior Member |
|
|
Dear User, I think you are referring to CMC codes. In Nepal they have a different calendar as well.
This is what is in the DHS6 Recode (Standard Recode Manual) page 5.
Century Month Code
All dates in the data file are expressed in terms of months and years and also as century month codes. A
century month code (CMC) is the number of the month since the start of the century. For example, January
1900 is CMC 1, January 1901 is CMC 13, January 1980 is CMC 961, and September 1994 is CMC 1137.
The CMC for a date is calculated from the month and year as follows:
CMC = (YY * 12) + MM for month MM in year 19YY.
To calculate the month and year from the CMC use the following formulae:
YY = int((CMC - 1) / 12)
MM = CMC - (YY * 12)
For Dates in 2000 and after the CMC is calculated as follows:
CMC = ((YYYY-1900) * 12) + MM for month MM in year YYYY.
To calculate the month and year from the CMC use the following formulae:
YYYY = int((CMC - 1) / 12)+1900
MM = CMC - ((YYYY-1900) * 12)
____________________________________________________________
We also now have CDC
Quote:
Century Day Code (CDC)
In DHS‐7, the DHS program introduced a new concept the Century Day Code (CDC). The CDC is
analogous to the century month code and gives the number of days since the beginning of 1900. The CDC for
a date of birth is computed in a similar manner to the CMC, using the reported day, month and year of birth.
Note that for simplicity in the calculation of the CDC the assumption is that 1900 is a leap year, but this is
also how Excel handles it. This does not affect any calculations of age, as all calculations are using a
consistent base.
The formulae to calculate the CDC of a date is an iterative process calculated in 2 steps:
Step 1: calculating the number of days since 1900 to the yyyy-1.
The formula to calculate the CDC is not as straight forward as the formulae to calculate the CMC
because the number of months per year is a fixed number (12 months). In the case of the CDC, the
calculation process for step 1 must be done with an iterative function because the number of days per
year varies depending if it's a leap year (366 days) or if it's regular year (365 days).
Date = [dd]/[mm]/[yyyy]
CumulativeDays1 = 0
do i = 1900 while i < [yyyy]
CumulativeDays1 = CumulativeDays1 + 365 + (LeapYear = false);
enddo;
Note: the statement (LeapYear = false) will return value of 0 or 1
Step 2: calculating the number of days from yyyy to mm/dd
An interactive function should be used in this process because the number of days per months also
varies. There are months with 30 and 31 days, besides February can have 28 or 29 days depending if
it's a leap year or not.
Date = [dd]/[mm]/[yyyy]
CumulativeDays2 = 0
xdays = 0 (working variable)
do i = 1 while i < [mm]
if mm in 1,3,5 xdays = 31 endif; (January, March, May)
if mm in 2 xdays = 28 + (LeapYear = false) endif; (February)
If mm in 4,6 xdays = 30 endif; ( April, June)
CumulativeDays2 = CumulativeDays2 + xdays;
enddo;
Note: the statement (LeapYear = false) will return value of 0 or 1
CDC = CumulativeDays1 + CumulativeDays2 + [dd]
[Updated on: Thu, 30 August 2018 11:18] Report message to a moderator
|
|
|