Code:
version 16.1 mkdir temp_stata cd temp_stata clear input str10 v1 "one" "two" "three" "four" end export delimited using "myfile1.csv" clear input str10 v1 "five" "six" end export delimited using "myfile2.csv" *** this works frame create results str100 v1 str100 f frames dir frame change default local myfiles : dir . files "*.csv" foreach f of local myfiles { display "`f'" quietly import delimited "`f'", varnames(1) clear quietly keep in 1 frame post results (v1[1]) ("`f'") } frame change results compress list *** this doesn't /* tempname results frame create `results' str100 v1 str100 f frames dir frame change default local myfiles : dir . files "*.csv" foreach f of local myfiles { display "`f'" quietly import delimited "`f'", varnames(1) clear quietly keep in 1 frame post `results' (v1[1]) ("`f'") } frame change `results' compress list */
0 Response to tempname frames question
Post a Comment