Attaullah Shah
Moderator
Post count: 70

Let’s assume that you have a folder named temp in drive c and you have several .dta files in it. You wish to create a codebook from all the .dta files and save them to codebook.docx file. The following code will do the job.


 local files : dir "c:/temp" files "*.dta" 
 cd c:/temp

 foreach file in  `files'  {

        use  `file'  , clear
 	asdocx codebook , save(codebooks.docx)
 }