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
teffects nnmatch with no exact matchesHello everyone, I am trying to perform a nearest-neighbor matching in Stata by using the teffects c…
Averaging with a condition while generating a new variableHi there! I have household-level data with unique household_id. For each household, I have data for…
Dichotomous Independent variableHi I am working on the following data set and in order to determine my model, I have TOTALINVESTMEN…
cgmreg - error messageHi, I'm relatively new to stata, and cant seem to get around this error message. I am trying to car…
S.E. in xtreg and aregDear friends, I'm estimating a fixed effects model with an unbalanced panel data using both areg an…
Subscribe to:
Post Comments (Atom)
0 Response to Append csv files into one dta file
Post a Comment