I have a txt file containing some numbers, say 1 5 6 17 18. I would like to import this to Stata and use those numbers as the steps in a four loop. Manually I can copy and paste the values
Essentially I would like to programmatically do the same thing. Here is how I believe the ingredients in Stata should look like, but I have failed to properly finalize it:
The bold italic part is what I struggle with. Any ideas?
Code:
use data, clear foreach i in 1 5 6 17 18 { % do something with the i's }
Essentially I would like to programmatically do the same thing. Here is how I believe the ingredients in Stata should look like, but I have failed to properly finalize it:
Code:
import delim using "text.txt", delim(" ") local `steps' transform data to local variable use data, clear foreach i in `steps' { % do something with the i's }
Comment