Dear Stata users,
I'm having trouble generating a new variable in Stata. This is the current command I run:
gen regulation=.
replace regulation=0 if DateAnnounced<=9/2/1992 & TargetNation=="AS"
However, Stata mentions that 0 real changes are made. However, I do know that in my dataset are observations present with the TargetNation being "AS" (Austria) and are announced before september 2nd, 1992 (I found out by running a command where I used my Year variable instead of my DateAnnounced variable. If I look at the variable DateAnnounced, I see in the top box that Stata sees the variable as a date, so I figured Stata would also know if I want observations on that date and before. However, this does not seem to work. I need dates instead of years as I need specific days on which I want to run my regression. Does someone know why Stata doesn't seem to get dates if I use the <= and then put in the desired date? (see screenshot for how the variable looks)
Thank you in advance!
Kind regards,
Danielle
I'm having trouble generating a new variable in Stata. This is the current command I run:
gen regulation=.
replace regulation=0 if DateAnnounced<=9/2/1992 & TargetNation=="AS"
However, Stata mentions that 0 real changes are made. However, I do know that in my dataset are observations present with the TargetNation being "AS" (Austria) and are announced before september 2nd, 1992 (I found out by running a command where I used my Year variable instead of my DateAnnounced variable. If I look at the variable DateAnnounced, I see in the top box that Stata sees the variable as a date, so I figured Stata would also know if I want observations on that date and before. However, this does not seem to work. I need dates instead of years as I need specific days on which I want to run my regression. Does someone know why Stata doesn't seem to get dates if I use the <= and then put in the desired date? (see screenshot for how the variable looks)
Thank you in advance!
Kind regards,
Danielle
Comment