I wanted to import spss files into stata. The format of the file is month_date_raw_data.sav. For example "1_2020_raw_data.sav" I tried to write a loop to call in each month and year but I keep getting an error r(601). Why isn't this loop working?
HTML Code:
forvalues i= 2020/2021 { forvalues j=1/12 { import spss using "C:\Users\bf\files\spss\`j'_`i'_raw_data.sav" , case(lower) clear *Add year and month variable gen year= `j' gen month=`i' tempfile part_`i'`j' save `part_`i''`j' } }
Comment