Generate Dummy variables
Posted: Thu Feb 05, 2015 9:18 am
Hi,
I have a quarterly workfile. I would like to generate a dummy variable for each date of my workfile.
I tried the following code:
for !j=2000 to 2014
for !i=1 to 4
dummy_{!j}Q{!i}=@recode(@date=@dateval("{!j}Q{!i}"),1,0)
next
next
The code does generate the series but they only have NAs.
Any idea?
Thanks a lot in advance for your help!!
I have a quarterly workfile. I would like to generate a dummy variable for each date of my workfile.
I tried the following code:
for !j=2000 to 2014
for !i=1 to 4
dummy_{!j}Q{!i}=@recode(@date=@dateval("{!j}Q{!i}"),1,0)
next
next
The code does generate the series but they only have NAs.
Any idea?
Thanks a lot in advance for your help!!