Hello everyone,
I am trying to implement a simulation and face an error message. Apparently it has to do with the previously defined global macro that I use in the simulation program. The error can be illustrated by this simple example code:
And I get the error message:
Usually I have not faced any problems using global macros in the program used by the simulation. So what exactly am I overlooking in this case?
I would be greatful for any hint.
Best,
Tom Storwitz
I am trying to implement a simulation and face an error message. Apparently it has to do with the previously defined global macro that I use in the simulation program. The error can be illustrated by this simple example code:
Code:
clear set seed 123 set obs 100 gen binary = runiformint(0,1) gen indep = runiformint(0,100) // EXAMPLE PROBIT REGRESSION, SAVING ONE REGRESSION OUTPUT VALUE AS A GLOBAL MACRO probit binary indep global probit_cons _b[_cons] // SIMULATION PROGRAM capture program drop sim1 program define sim1 // IRRELEVANT EXAMPLE CALCULATION IN THE SIMULATION clear set obs 10 gen uni = runiform() sum uni, meanonly scalar a = r(mean) // THIS IS THE PROBLEMATIC LINE - WHY? gen test = normal($probit_cons) end simulate a, reps(10): sim1
Code:
no variables defined an error occurred when simulate executed sim1 r(111)
I would be greatful for any hint.
Best,
Tom Storwitz
Comment