Monday, July 29, 2019

Creating a binary varible from a date variable

I would like to create a variable where there is only two variables (0=heating, 1=non-heating)

I have the following date variable
startdate
DDMMYYY

Originally I would like to;
gen season=.
recode season .=o if startdate==01nov-31april
recode season .=1 if startdate==01may-31oct


But I don't know how apply the range from a date variable.


Any help is very much appreciated

Best
Charlotte

No comments:

Post a Comment