I am writing an ado file which includes Monte Carlo simulations.
I define the frame which holds successive simulation results:
tempname fdata_replicates
At various times in the program I want to display summary measures of the current variables in this dataframe. Since I need to do this repeatedly, I want to put the relevant commands in a subprogram:
program displayMonteCarlo
version 17
syntax [varlist], datafile(name) [stats(string) ]
if "`stats'" == "" local stats "mean count min max"
if "`varlist'" == "" {
frame `datafile':qui ds
local varlist `r(varlist)'
}
frame `datafile': tabstat `varlist', stat(`stats') columns(statistics) varwidth(30)
end
and call this sub program using:
displayMonteCarlo, datafile(`fdata_replicates')
This is not working. The subprogram tries to use the current frame, not the frame whose name I am attempting to pass.
What am I doing wrong??
Thanks
I define the frame which holds successive simulation results:
tempname fdata_replicates
At various times in the program I want to display summary measures of the current variables in this dataframe. Since I need to do this repeatedly, I want to put the relevant commands in a subprogram:
program displayMonteCarlo
version 17
syntax [varlist], datafile(name) [stats(string) ]
if "`stats'" == "" local stats "mean count min max"
if "`varlist'" == "" {
frame `datafile':qui ds
local varlist `r(varlist)'
}
frame `datafile': tabstat `varlist', stat(`stats') columns(statistics) varwidth(30)
end
and call this sub program using:
displayMonteCarlo, datafile(`fdata_replicates')
This is not working. The subprogram tries to use the current frame, not the frame whose name I am attempting to pass.
What am I doing wrong??
Thanks
Comment