CMC codes [message #60] |
Mon, 18 February 2013 17:53 |
DHS user
Messages: 111 Registered: February 2013
|
Senior Member |
|
|
I am working with the DHS surveys in Nepal and have a question regarding the interview date (v008) for each of the surveys. When using your recommended formulas to convert these CMC dates to year and month formats, the years do not appear to correspond to the survey year. For example, I get years 1952 and 1953 for the 1996 survey wave.
Can you please advise as to how to obtain the correct year for this variable?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: CMC codes [message #17832 is a reply to message #17823] |
Thu, 20 June 2019 15:20 |
Trevor-DHS
Messages: 802 Registered: January 2013
|
Senior Member |
|
|
I realized that the conversion from Nepali to English dates is actually relatively simple and have a couple of solutions below.
For converting dates, there are a couple of things you can do:
1) Convert century month codes (e.g. v008). This is not exact as the Nepali months start in the middle of the Western months, but approximately you can subtract 681 months from the Century month code to be equivalent to the Western calendar's century month code.
2) Convert century day codes (e.g. v008a). To convert the century day codes in the dataset to Western version, add 15809. For example, Shrawan 18, 2073 (century day code 26775) is the same as August 2, 2016 which would be century day code 42584, and 42584-26775=15809.
You can then check the day, month, or year of any value in Excel by using the following formulae:
If cell A1 is 42584 then
=day(A1) would give 2
=month(A1) would give 8
=year(A1) would give 2016
If you want to produce day, month and year variables in Stata, you can do the following:
* Adjust to Stata date - add 15809 to adjust for the calendars, and subtract 21916 as Stata counts days from 1/1/1960
gen v008a_stata=v008a+15809-21916
* Get day, month and year from Stata date
gen v008a_d=day(v008a_stata)
gen v008a_m=month(v008a_stata)
gen v008a_y=year(v008a_stata)
You can then re-create the century month code if you want to from these as cmc=(v008a_y - 1900) * 12 + v008_m.
[Updated on: Thu, 20 June 2019 15:21] Report message to a moderator
|
|
|