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
Variance of a ratio with unknown covariance between numerator and denominatorI have two means and their standard errors from a paper. I would like to calculate their ratio and i…
How i can make columns from list in other variableHi, i have some data with different column from which i wan to make i am attaching desired output …
Kind suggestion of a methodology for a sensitivity or robustness check of fixed effectPlease, can someone help me in the group, I am doing research in the area of health economics (child…
foreach loop with different prefixesI need to do some data manipulation that involves variables with many different alpha prefixes (rang…
How can I label the values of the bars within a twoway bar graph?Hello! I am creating a bar graph with confidence intervals(picture attached below). It would be nic…
Subscribe to:
Post Comments (Atom)
0 Response to Dummy Variable and Date
Post a Comment