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
Forloops in panel data - am I indexing incorrectly and using 'if' statements correctly?I am trying to use a loop in stata to achieve the following: My example data is below, but a brief …
create analytical/inverse variance weights for a variableDear all, I create a new topic here since my last topic is a bit unclear. I know how to tabulate t…
using "program" command and applying the "program" createdHello, I created this program, which I am trying to apply in the code later: program fixK renvars …
Forloops in panel data - am I indexing incorrectly?I am trying to use a loop in stata to achieve the following: My example data is below, but a brief …
Help in generating a variable based on certain conditionDear All I want to create a disability identifier based on the following criteria those who respon…
Subscribe to:
Post Comments (Atom)
0 Response to How to repeat some command lines
Post a Comment