When I loop over many Excel sheets, I use "import" command to input the data. However, because each sheet has different number of rows, is it right that the option "cellrange" must be ajusted one by one? Can I just write 1 command and run the loop?
For example, I wrote the command like this:
The part "M27" is automatically set by Stata because 27 is the number of rows in the data sheet I import. I wonder when I run this loop, will Stata automatically set M30, M40, M100,... according to the range of rows in each data sheet, or will it import only till M27 as the first sheet?
Thanks a lot for your help.
For example, I wrote the command like this:
Code:
foreach x of local x_list { clear import "path_including_`x'", sheet(S1) cellrange(A5:M27) firstrow do ... save "path_including_`x'", replace }
Thanks a lot for your help.
Comment