Dear Statalist Users,
I have multiple txt files and I want to convert them into stata files so that I can append the data.
This is the manual way of importing the data and then saving it for stata.
import delimited "C:\Dir\Manu - 00-01.txt", delimiter("|") varnames(2)
rename v1 company
rename v2 product
save manu_00-01
However, I have 20 text files in the form of Manu - 00-01.txt, Manu - 00-02.txt, Manu - 00-03.txt and so on till Manu - 18-19.txt.
I seek you suggestion on writing a loop for the same so that I can append it accordingly
Thank you
Related Posts with Writing a Loop
Help with clock() functionDear all, I had a time variable in string format. I use clock() function to change it to Stata read…
Statistical inferenceThe country is Japan, the period is 1972-2020, and the data is annual information. The current accou…
Generating new variables using macros and loopsHello, I am trying to generate new variables with the use of macros and having issues with the synta…
merging data with different time frequenciesHello, I have looked for guidance from other posts but could not solve this: I have two datasets- 'D…
How to generate the Strong Parallel Trend Assumption presented in Callaway, Goodman-Bacon & Sant'Anna 2021I'm running a DID model with multiple timer periods and continuous treatment. I currently run the tr…
Subscribe to:
Post Comments (Atom)
0 Response to Writing a Loop
Post a Comment