Hello,
I have 38 csvfiles that I want to merge into one DTA file using a loop (foreach) . My csvfiles are named in "2021-MM-YY.csv" format. The variable names are contained in one particular row (#Row 4) of the dataset and I want to also extract a certain range of rows (4-2940) from each csv file and bring it into the (Append ) data. I also want to extract the date out of the file name and store it in a date variable in the dataset, to be able to identify what date the particular observation is for. So far I have only been able to figure out this part of the loop to import the file, where I'm still confused about how to name the file appropriately in the path.
import delimited "files\2021-**-**.csv", delimiter(comma, collapse) varnames(4) encoding(UTF-8) rowrange(:2940) parselocale(en_IN)
Related Posts with Append csv files into one dta file
nested loopsin the case that I want to run the analysis of a group of variables by quintiles and considering als…
Postdoctoral Employment opportunityDo you have experience in econometrics, Stata, and simulation techniques? We have an immediate openi…
Creating loop on date variableHello, My date variable (x11) is in the format:%td. I am trying to filter out a sub sample of my da…
Sum of squared deviationI have a dataset as follows: time return of stock a return of stock b eturn of stock c eturn of s…
For loopI have a dataset with 30 variables containing one ICD-code each. I need to identify certain specific…
Subscribe to:
Post Comments (Atom)
0 Response to Append csv files into one dta file
Post a Comment