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.
0 Response to Dummy Variable and Date
Post a Comment