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
 Trevor-DHS Messages: 680Registered: 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

 CMC codes By: DHS user on Mon, 18 February 2013 17:53 Re: CMC codes By: Kerry on Tue, 19 March 2013 10:20 Re: CMC codes By: Trevor-DHS on Tue, 19 March 2013 18:25 Re: CMC codes By: Kerry on Thu, 28 March 2013 09:18 Re: CMC codes By: l.bliznashka on Tue, 22 October 2013 13:42 Re: CMC codes By: Trevor-DHS on Thu, 05 December 2013 23:52 Re: CMC codes By: Rojan on Mon, 07 September 2015 14:58 Re: CMC codes By: timarthias on Mon, 10 September 2018 02:59 Re: CMC codes By: Rojan on Mon, 10 September 2018 03:33 Re: CMC codes By: timarthias on Mon, 10 September 2018 05:24 Re: CMC codes By: Trevor-DHS on Mon, 10 September 2018 10:11 Re: CMC codes By: kmarchesi on Sat, 06 October 2018 20:43 Re: CMC codes By: Rojan on Sun, 07 October 2018 00:13 Re: CMC codes By: kmarchesi on Sun, 07 October 2018 10:39 Re: CMC codes By: sabine on Sat, 02 February 2019 13:06 Re: CMC codes By: umg on Sun, 19 May 2019 09:37 Re: CMC codes By: fuller14 on Mon, 17 June 2019 15:58 Re: CMC codes By: Trevor-DHS on Thu, 20 June 2019 15:20
 Previous Topic: V007 in most recent Nepal DHS survey Next Topic: maternal and child health
Goto Forum:

Current Time: Wed Apr 8 12:37:11 Eastern Daylight Time 2020