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
Should I add age^2 when working with panel data or not?Hi all, I am analyzing the effect of marital status on life satisfaction for a period of 32 years o…
Hep with spmap option polygonHi, Im working in a map of the metro area of Medellín, Colombia. So far good, but when I try to impo…
Help with scheme entries affecting rarea plots using marginsplotI am trying to create a scheme that changes the intensity, opacity, or color of a marginsplot when t…
asdoc: version update - New features of font, table header formatting, etc. Export results to Word from StataVersion 2.3.3.2, dated Feb 23, 2019, is finally here, thanks for Kit Baum for updating it on SSC. Th…
Relabel using grc1legI am trying to show 4 different graph plots in one same illustration. I am using the command grc1leg…
Subscribe to:
Post Comments (Atom)
0 Response to date and time
Post a Comment