I have some lines of code in a STATA do file that I would like to reuse/execute and different points in the do file. Similar to a javascript function... however I do not necessarily need an input variable.
for example:
I have some code:
for x in test1 test2 test3{
rename my_`x' mynew_`x'
}
and i want to execute those 3 lines of code at various points in the do file. As if there was a way to label those three lines "codeA" and then "execute codeA" later in the do file.
Any suggestions?
for example:
I have some code:
for x in test1 test2 test3{
rename my_`x' mynew_`x'
}
and i want to execute those 3 lines of code at various points in the do file. As if there was a way to label those three lines "codeA" and then "execute codeA" later in the do file.
Any suggestions?
Comment