I would like to use a do loop to read in a series of excel files, save them as .dta files, then append the .dta files. Additional files are being generated regularly. I would like to be able to run the do file without having to specify a maximum value each time. For example, I would like not to have to specify 52 in the code below, since soon I will have more than 52 files:
**read in files by round, save as .dta
forvalues i = 1(1)52 {
import excel "all_bids_round_`i'", firstrow clear
save allbids`i', replace
}
**append the rounds files
clear
use allbids1
forvalues i = 2(1)52 {
append using "allbids`i'", force
}
Thanks very much!
Related Posts with forvalues with indefinite end value
Problem with date formatI split a variable which had date and time together to one with just the dates. Now I am trying to c…
Standard errors ivqte vs qreg2Maybe more of an Econometrics question, but I was wondering why the standard errors between qreg2 an…
categorical variable sample sizesHi, I am running a regression using the following code: Code: reghdfe incvote i.X controls, absorb…
directions of endogenous coefficients are the opposite in simultaneous equation modelHi everyone, I'm running simultaneous equation model (2 equations) but getting a weird result. My a…
Automatic average calculationHey there I have another question. Here as example for the Grunfeld database: I need a code that cal…
Subscribe to:
Post Comments (Atom)
0 Response to forvalues with indefinite end value
Post a Comment