Hello guys!
I'm working with halfyearly data and I'm trying to use conditionals, however it appears and error. The format of the data is %th.
This is what I'm trying to do:
After the first line it appears this error:
I would really appreciate your help.
I'm working with halfyearly data and I'm trying to use conditionals, however it appears and error. The format of the data is %th.
This is what I'm trying to do:
Code:
gen y1h1=1 if hdate==2016h1
replace y1h1=0 if hdate!=2016h1
gen y1h2=1 if hdate==2016h2
replace y1h2=0 if hdate!=2016h2
gen y2h1=1 if hdate==2017h1
replace y2h1=0 if hdate!=2017h1
gen y2h2=1 if hdate==2017h2
replace y2h2=0 if hdate!=2017h2
gen y3h1=1 if hdate==2018h1
replace y3h1=0 if hdate!=2018h1
gen y3h2=1 if hdate==2018h2
replace y3h2=0 if hdate!=2018h2
gen y4h1=1 if hdate==2019h1
replace y4h1=0 if hdate!=2019h1
gen y4h2=1 if hdate==2019h2
replace y4h2=0 if hdate!=2019h2
Code:
. gen y1h1=1 if hdate==2016h1 2016h1 invalid name r(198);

Comment