The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Countries » Nepal » CMC codes
Re: CMC codes [message #17832 is a reply to message #17823] Thu, 20 June 2019 15:20 Go to previous message
Trevor-DHS is currently offline  Trevor-DHS
Messages: 803
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

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: V007 in most recent Nepal DHS survey
Next Topic: maternal and child health
Goto Forum:
  


Current Time: Mon Dec 2 17:40:13 Coordinated Universal Time 2024