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
Graph dates X-axis formatHello, I have what I think is a simple problem but I cannot seem to solve: I want to graph just the…
ACTEST Error: "struct ms_vcvorthog undefined"Hi folks, I am re-running some ITSA script from a couple of months ago with some updated data and ha…
import all excel sheets from a specified folder, and save as STATA filesHello - I am attempting to import all excel sheets from a specified folder, and save as STATA files.…
choosing the correct model estimationgood evening everyone i have a big problem with my database already i was focused on the gmm estimat…
PCA for Categorical VariableHow can I Perform PCA for categorical variables in STATA? …
Subscribe to:
Post Comments (Atom)
0 Response to date and time
Post a Comment