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
Adding sample size to graphsI want to add sample size for each of the subgraphs in the command below: graph bar if adoption == …
Tabulating descriptive statistics by group and year Hi folks, give the data below, i would like to produce a similar table as shown in the image attach…
Estimating Random Effects in Mixed-effect Logistic Regression ModelHello, I am facing a crucial problem during the estimation of a random effect in a mixed effect log…
Merging one of the rows with another within multiple rows of observationHello I have a dataset in which each identifier (ID) has multiple rows of observations, ranging fro…
deleting words in () for each row?Dear All, I found this question here (https://bbs.pinggu.org/thread-10057724-1-1.html). The data is:…
Subscribe to:
Post Comments (Atom)
0 Response to forvalues with indefinite end value
Post a Comment