Hello all,
I need to repeat 3 line of commands in stata to create updated observations for three variables (FV1, ID10066, amort1) on my dataset, the calculation for the three happens depending on each other, therefore each row is needed for calculations of the next row. When I manually repeat these lines and run them then I get the desired result. However I look for a way to automatically do this. I also looked into writing a loop to do so but I could not figure out what should be done to get it write. The commands are the following: (first 4 observations are filled out already before getting to these lines of code)
replace FV1 = FV1[_n-1] - amort1 if date > date[3]
replace ID10066 = (FV1[_n-1])*rq if date > date[3]
replace amort1 = pmt - ID10066 if date > date[4]
Please let me know if I need to add extra information for clarity. But the purpose here is only to find a way to repeat these lines automatically instead of typing/running them again and again.
Thank you all.
Related Posts with How to repeat some command lines
Returning to variable window after outreg2 (seeout) in Stata 16.I have noticed a slight change in Stata 16 after I "seeout" my regression output after "outreg2". Be…
Plotting Interactions after xtregHello everyone, I am currently struggling to create a graph to visualize the moderation effect in m…
System GMM: does it includes fixed effects?Hello everyone, I have a panel of 97 countries over 18 years and I would like to estimate a model wi…
Standard deviation of industry-adjusted return on assets over five yearsDear STATA experts, My sample consists of firm-year observations panel with unbalanced data over th…
Help with stata codes to generate weights in a household surveyHi, I have two files: Central file (state1) and State file (state 1). I have to generate pooled est…
Subscribe to:
Post Comments (Atom)
0 Response to How to repeat some command lines
Post a Comment