Hello,
I am trying to convert all the files in a folder from spss to stata format. I went through some of the relevant posts and tried the suggestions but I keep getting some error. For example, if I try the code below, in which the file names are given individually as a, b, c, d, e and f:
foreach i in a b c d e f{
import spss using "\Desktop\Datasets\country\`i'.sav", clear
save "\\Desktop\Datasets\country\`i'.dta", replace
}
I get the error as:
file \\Desktop\Datasets\country\`i'.sav not found
Is there something wrong with the way I am calling the filenames in the loop. I would like to make the above code work please, as I can use the same structure for some other work as well.
Thanks for your help.
Regards
Vignesh
I am trying to convert all the files in a folder from spss to stata format. I went through some of the relevant posts and tried the suggestions but I keep getting some error. For example, if I try the code below, in which the file names are given individually as a, b, c, d, e and f:
foreach i in a b c d e f{
import spss using "\Desktop\Datasets\country\`i'.sav", clear
save "\\Desktop\Datasets\country\`i'.dta", replace
}
I get the error as:
file \\Desktop\Datasets\country\`i'.sav not found
Is there something wrong with the way I am calling the filenames in the loop. I would like to make the above code work please, as I can use the same structure for some other work as well.
Thanks for your help.
Regards
Vignesh
Comment