Hi!
I have panel data with different locations that takes the values 1 - 9 indicating a spesific location. Also, I have created a month variable to take the value 1-12 depending on which month it is per observation and the same for year where we have for example 2020 as a value indicating witch year.
I am trying to generate a dummy variable with the name "leads1", and i want it to take the value 1 based on numerous of arguments.
so what i try to do with commands is this:
generate leads1 = 0
replace leads1=1 if location=4 & month=1 & year=2018 (what i try to do here in words is to give the variable the value 1 if it is january2018 and the location is 4)
another variable i try to make is
generate lags5 =0
replace lags5=1 if location= 9 & month8-12 & year=2017 & month=1-12 year= 2018 (what i try to do here is to give the lags variable the value 1 if the location is 9 from month 8 in 2017 and to december 2018.
first of all, i get a syntax error which i believe is ==, but i do not know which one to change. Also i believe that i am doing it all wrong....
Does anyone know and can help me?
if you think it is easier i actually have a %tc variable too for time but i think it is even harder to use that variable to get the outcome i serch for...
Related Posts with date and time
Replacing missing value by linear intervals between tow points across time.Dear Statalist, I am current facing a bit of dilemma with missing variables. I have merge two datas…
Logistic regression shows negative adj. (McFadden's) R2 but statistically sig. coefficient for main predictor variable. How to interpret?As the title says, I have a logistic regression model with a negative adjusted R2 (McFadden's), but …
DiagonalI am modelling a huge database and I have to create a new variable that contains the value of the di…
Traj Command ErrorI am using MP 14 ver. and was able to use traj. command until a couple of months ago. Now I see the …
Customization of Bar GraphI have created a stacked bar graph to look at my main categorical variable which has Yes/No Response…
Subscribe to:
Post Comments (Atom)
0 Response to date and time
Post a Comment