The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Countries » India » pre and post Covid-19 groups India
pre and post Covid-19 groups India [message #28312] Tue, 12 December 2023 07:26 Go to next message
Varsha is currently offline  Varsha
Messages: 39
Registered: November 2020
Member
Hello,

I want to create two groups based on the first lockdown in India: pre-Covid would be those surveyed before 25 March 2020 date and post on or after this date. How can I do that in stata? Please help.
Re: pre and post Covid-19 groups India [message #28315 is a reply to message #28312] Tue, 12 December 2023 14:17 Go to previous messageGo to next message
Varsha is currently offline  Varsha
Messages: 39
Registered: November 2020
Member
I created the year and month of interview variables using the following codes:

gen year_of_interview = int(( hv008 - 1 )/12) + 1900
gen month_of_interview = hv008 - (( year_of_interview - 1900) * 12)

Should be use the variable 'date of interview (CMC)' when month and year of interview variables are already given?


[Updated on: Tue, 12 December 2023 14:22]

Report message to a moderator

Re: pre and post Covid-19 groups India [message #28323 is a reply to message #28315] Thu, 14 December 2023 07:27 Go to previous messageGo to next message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3199
Registered: February 2013
Senior Member
Following is a response from Senior DHS staff member, Tom Pullum:


The Stata lines pasted below will give a variable that is 1 for interview dates on or after March 25, 2020, and 0 for earlier dates. If you want to run this in the IR or KR file, just replace "hv" with "v'.

use "...IAPR7EFL.DTA", clear

gen days_out=mdy(hv006,hv016,hv007)-mdy(3,25,2020)
gen     after=0
replace after=1 if days_out>=0
label define after 0 "" 1 ""
label values after after

tab after
 

Using the "mdy" command will give what you want.

[Updated on: Thu, 14 December 2023 07:35]

Report message to a moderator

Re: pre and post Covid-19 groups India [message #28332 is a reply to message #28323] Fri, 15 December 2023 04:36 Go to previous message
Varsha is currently offline  Varsha
Messages: 39
Registered: November 2020
Member
Thank you, Tom.
Previous Topic: Variables on caste and wealth
Next Topic: NFHS-5 District vis a vis 2011 census
Goto Forum:
  


Current Time: Wed Nov 27 13:09:37 Coordinated Universal Time 2024