I'm new to Stata and would highly appreciate any help.
I have a panel data. I want to implement for the following algorithm but I cannot figure out the implementation in Stata.
for id
for time
for x = var(id, time)
for y = var(id, time-1)
if x !=y then
flag = 1
else if x = y then
flag = 0
end if
end
end
end
end
Related Posts with Looping with lagged values
Mediation analysis and dealing with categorical variablesDear altruists, I have an independent variable "tob_smk", dependent variable "multimbd_cat" and "phy…
Dummy Variable Financial Expert with Panel DataHi Guys, I'm currently writing my thesis about the influence of the tenure of outside directors on …
Identifying a change in employer in panel dataHello everybody. I want to track when a group of individuals changes from one employer to another d…
What kind of assumption (distribution) does STATA use to calculate proportion 95%CI?Dear researchers, It is my first post. I used stata code to calculate 95%CI for proportion to calcul…
Creating Dummy Variable each company-year with multiple observationsHi Guys, I'm currently writing my thesis about the influence of the tenure of outside directors on …
Subscribe to:
Post Comments (Atom)
0 Response to Looping with lagged values
Post a Comment