Your code only needs some very minor modifications. I know the commands inside the loop are working for a single file but not really being able to automate for all files. Write_dta(data,"c:/directory/filename.dta", version = 12, label = attr(data, "label")) #Load file to be converted into STATA12 version #vector with name of files to be convertedĪll_files <- list.files(pattern="*.dta",full.names = TRUE) This is what I have got so far: setwd("C:/FilesLocation") Ideally, I want to keep the names of the original folders and files but save the converted versions into a new location. dta files into Stata 12 format (keeping all labels) to then analyze. I want to create an automated process of converting all Stata 16. dta files (and other types of files not relevant to this question). I am using RStudio (running R 4.0.1) and Stata 12 for Windows and have got a large number of folders with Stata 16.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |