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
Insufficient observations when running panel dataHello all, I have a question I am trying to run a linear probability model with the following comman…
Create an HHI index at quarterly-yearly and yearly level Code: * Example generated by -dataex-. To install: ssc install dataex clear input int year byte qu…
Different result count and tabulate commands, why?Hello, I have a question, maybe a bit basic, but I did not find the solution yet. I used the 'count…
No observations - Portfolio SortsHello everyone, I have double-sorted my data and dropped observations to include only one observati…
lassologit: Stata package for logistic lasso regressionFollowing up on lassopack, Chris Hansen, Mark Schaffer and myself have developed a package for logis…
Subscribe to:
Post Comments (Atom)
0 Response to How to repeat some command lines
Post a Comment