I have daily data for the years 1960 - 2010. Each year's data is in a csv file, the files (in one directory) are named 1960, 1961,...2010. I would like to open the files and run the following command:
I would also like to generate a year variable (can this be set equal to the file name?). Then save the file in dta.Can this be done in a loop? Thanks a lot!
Code:
drop v1
foreach v of var day_* {
replace `v' = "." if inlist(`v', "NA")
}
destring, replace
reshape long day_, i( iso3 lon lat) j (day)
rename day_ precip

Comment