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
Pooled Regression with time variableHi All, I have annual data, and I want to run a pooled OLS regression and include a time variable a…
qlqc30 command questionHi, I'm trying to analyze quality of life data using the qlqc30 command (https://journals.sagepub.co…
Creating a new variable based on all the following values of an existing variableHello -- I was unsure how to word the title, but hopefully it offers some clue as to what I am tryin…
LoopHello I have a panel data of ten 9 countries, I want to run this code for the pair of 4 countries …
about mixed command and the random effectsDear professors When I type the command "mixed education culture ses100 $var || schids: culture, …
Subscribe to:
Post Comments (Atom)
0 Response to Dummy Variable and Date
Post a Comment