Dear All,
I have been trying to call a certain program inside a loop. (I have placed it outside the loop as placing it inside caused problems)
Code:
//program drop name
program name
drop `2'
end
clear
local myfilelist : dir "/Users/adrianomariani/Desktop/Research Assistant scheme/Forecasts excel" files "*.xlsx"
foreach filename of local myfilelist {
.....
findname instit , not local(g)
name `g'
program drop name
......
}
When I try to run this loop, it stops at the first called program: 'name', it executes the command (ie drops the variable in the second position of the list of variables provided by 'findname' and placed in local macro 'g') however nonetheless it runs it, it stops the loop with the error message: r(111)-"variable E not found", which is the variable that was successfully dropped.
I have checked there may be a problem with the ordering of the variables, but this is not the case (and even if there was it should drop anyways the second variable in the list provided by the local)
If I try to run this outside of a loop, ie if I do something like:
Code:
//program drop name
program name
drop `2'
end
findname instit , not local(g)
name `g'
program drop name
It returns no problems, drops the variable and returns no error message. Thus I believe this specific problem is when the program is called within a loop.
Any suggestions would be largely appreciated.
Thanks to all
Related Posts with Calling a program inside a loop
Help with xtdcce2 - unit specific error correction termsHello all, I have recently come across to xtdcce2 and would like to ask some questions. - If I use…
Graph twoway scatter with 95% CI and Odds RatioI got a dataset with 2 group of ppl (group1 is male, group 2 is female), and I got their odds ratio,…
Recode multiple observations to missingHello Statalist I need help on how i can recode multiple observations to missing. In the data examp…
Fixed effects conditional logit model, problems with Age and Year's effectHello everyone, I am using unbalanced panel data on individual respondents (T = 11 and N = 83687). …
Is it possible to generate latent class at firm level instead of firm year level.I would like to do the latent class regression. The sample is at firm-year level. Normally, the gsem…
Subscribe to:
Post Comments (Atom)
0 Response to Calling a program inside a loop
Post a Comment