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...
0 Response to date and time
Post a Comment