Hi, I have been trying to loop over some file names.
I have something like this:
foreach s of num 2007/2015{
clear all
use "$path/Matricula Universitaria/`s'_1C.dta", clear
merge m:m mrun using "$path/Matricula Universitaria/`s+1'_2A.dta", keep(match master) force
}
For instance, I want to match the database 2007_1C with the 2008_1A but I can't get the `s+1' to work. If I do that, it merges the 2007_1C with the 2007_1A
If I write
merge m:m mrun using "$path/Matricula Universitaria/`s'+1_2A.dta", keep(match master) force
I get the following error message:
file C:.../Matricula Universitaria/2007+1_2A.dta not found
Any help is welcome! Thanks
Related Posts with Loop over file names
Normalizing GraphsHello All, I am attempting to normalize my graph to match the unconditional average for the corresp…
merging datasetshi guys, would anyone please be able to explain to me how to combine two datasets, one of which is a…
how to destring a variable containing some observations in a range?I have a variable wage. The wage variable has some observations in range, such as 400-500, 1200-1300…
Running svy and clogit and get "the group() variable is not nested within the final stage sampling units" errorHi, I am working with National Inpatient Sample (NIS). Considering the survey design, I am running …
How can I copy the entire Stata code *.do I'm running in an excel fileHi, I am running multiple simulations per day and I would like to get all necessary information enc…
Subscribe to:
Post Comments (Atom)
0 Response to Loop over file names
Post a Comment