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", replace
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 your suggestion on writing a loop for the same so that I can append it accordingly
Thank you
Related Posts with Writing a Loop
Generating a New Variable based on Conditional IF StatementsHello STATA Experts: I am trying to create a new variable based on the existence of certain conditio…
P trend valueHello, I'm trying to calculate the P trend value for an event risk according to the different disea…
Stata- margins and rifreg commandHi, We have a problem with margins after rifreg command: it works without writting xi in front of ri…
Does data on a time series need to be balanced like panel data?Does data on a time series need to be balanced like panel data? …
Rosenbaum BoundsHi, I have conducted propensity score matching using the WHO-5 Mental Health Index as my outcome va…
Subscribe to:
Post Comments (Atom)
0 Response to Writing a Loop
Post a Comment