Hey everyone,
I'm attempting to assemble a panel dataset using a handful of CSV files each of which correspond to a single year. Each file has the same name ending in the year the data corresponds to. That is my csv files are "data1992.csv", "data1993.csv", eta. I just want to import them, generate a variable corresponding to the year, and then save the file as .dta. My current attempt is
forvalues i = 1992(1)2000 {
import delimited "hd'i'.csv"
gen year='i'
save tem'i'.dta, replace
}
Thanks for anyone's help or advice!
Related Posts with forvalue index included in csv file name
T-test of difference between two regression coefficients within same modelHello, I have one single regression model estimating the coefficients (b) of two independent variab…
Stata Crashes while attempting collapseHello All, I run Stata SE 15.1 on a computer with 32 GB of RAM. I use Ubuntu as OS. And I have alre…
conditions by groupHi there, I have the following data and I want a variable that is 1 if, by firmid, there is at least…
Saving tabstat results in new variablesHello, I'm using tabstat to generate weighted standard deviations, by year, for two variables in a …
line graph at country and year level for several variables using levelsofHello all, I have a panel long format dataset that can be found attached containing year and countr…
Subscribe to:
Post Comments (Atom)
0 Response to forvalue index included in csv file name
Post a Comment