Hi Everyone!
I'm kinda new to Stata and I'm trying to import and append different excel worksheets in a single .dta file. Reading on the forum, I managed to create the different .dta files, each one corresponding to each worksheet. The problem is that in the column C of each worksheet (showing the ID of a company) we can find sometimes only numerical variables (for instance: 2131231) and sometimes both numerical and nonnumerical (34728QM) depending on the ID of the company. To append all the .dta files I was trying to do something like:
use filename1, clear foreach num of numlist 2/1126 { append using filename`num' } But the problem was that some of those variables in column C (like the previous 34728QM) need to be encoded. I don't know how to do this in a loop and each time I get something like "variable C is long in master but str6 in using data"
I hope you guys can help me =)
I'm kinda new to Stata and I'm trying to import and append different excel worksheets in a single .dta file. Reading on the forum, I managed to create the different .dta files, each one corresponding to each worksheet. The problem is that in the column C of each worksheet (showing the ID of a company) we can find sometimes only numerical variables (for instance: 2131231) and sometimes both numerical and nonnumerical (34728QM) depending on the ID of the company. To append all the .dta files I was trying to do something like:
use filename1, clear foreach num of numlist 2/1126 { append using filename`num' } But the problem was that some of those variables in column C (like the previous 34728QM) need to be encoded. I don't know how to do this in a loop and each time I get something like "variable C is long in master but str6 in using data"
I hope you guys can help me =)
Comment