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
Subgroup differences with metaprop? Hi, I am running a metanalysis to look at pooled estimates of attrition using metaprop. I have gen…
reclink functionHi guys, hope you are enjoying festivities. So basically I am trying to perform a fuzzy matching b…
How to make a random sample or subset of data with two group?I am new user of stata, kindly forgiven my ignorance and poor English. My case is here. I have a dat…
The occurance of autocorrelation and heteroscedasticity in a panel data OLS regressionHello everyone, I am currently running an OLS panel data regression with industry and time fixed ef…
Q about Difference-In-Difference model with unbalanced panel dataHi all, I am currently thinking to use difference-in-difference model in my project but not sure whe…
Subscribe to:
Post Comments (Atom)
0 Response to Dummy Variable and Date
Post a Comment