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
Longitudinal data analysisI am analyzing a data set of before/after biomarker values in 2 groups. I have baseline continuous c…
Appending ErrorsHello, I am trying to append several datasets together (yes they have been cleaned and are ready for…
local and conditionalsDear all, I am having troubles with some macros. My peace of code is Code: foreach ETC in $ETC{ …
display quotation marks in latexDear all, I would like to make a macro such that I can type in latex something between `` and ". Th…
Importing Excel Files into stataHi I am using these commands to import the excel files and save them into stata. but I am getting t…
Subscribe to:
Post Comments (Atom)
0 Response to Loop over file names
Post a Comment