I have a dataset that has quit date in %td (DMY) format. I also have two other variables that provide information about use of nicotine patch (no, yes), and the blood pressure levels at 6 months of of quit date. I need to generate a new indicator variable that takes on a value of 1 if the quit date was before a certain date, use of nicotine patch was yes and blood pressure was above 120, and 0 otherwise.
I am trying this:
gen newvar = .
replace newvar = 1 if birthdate<DMY & nicpatch==1 & bp >120 //nicpatch yes/no was coded as 1/0
However, I am having an issue and getting an error message as:
01apr2012 invalid name
r(198);
How can this problem be tackled?
Thanks much.
Related Posts with Dummy Variable and Date
Parallel trend assumption using leads and lagsI am running some robustness checks to my diff-in-diff specification. In particular, I am trying to …
Runing the same merge m:m and getting different resultsHello, im working with a panel data of exports between one country and others. Each product have a u…
Threshold VAR - imposing restrictions and generating GIRFsDear Stata users, I am using threshold in Stata 15.1 in order to estimate a fiscal policy threshold…
Looking for help! EASI Model in R with STATA. Thanks!I am currently trying to follow a world bank paper to estimate EASI model in R with STATA. The paper…
Group observations by Sequential DateHi, I need to group observations by participant_id where observations are date sequential (ie end_da…
Subscribe to:
Post Comments (Atom)
0 Response to Dummy Variable and Date
Post a Comment