PROC REG is an interactive proc. This means you can continue to submit MODEL statements after the RUN statement.
PROC REG also does row wise removal of data when any variable in the VAR or MODEL statement is missing.
It only keeps the variables in the MODEL or VAR statement. So if the variable has not been used in the MODEL or VAR statement before the first RUN it cannot be used in the next step because it may not account for the missing values correctly. Or at least that's my guess as to why it's this way.
You can just list all the variables in the VAR statement to get around this.
*does not work;
proc reg data=sashelp.cars;
model msrp = invoice cylinders mpg_city mpg_highway;
run;
model msrp = weight invoice cylinders;
run;quit;
*does work;
proc reg data=sashelp.cars;
var msrp invoice cylinders mpg_city mpg_highway weight;
model msrp = invoice cylinders mpg_city mpg_highway;
run;
model msrp = weight invoice cylinders;
run;quit;
@benepoko wrote:
Hi,guys,
Here are my codes,
PROC REG DATA=DATASET;
MODEL Y = X M C1 C2;
TITLE 'REG OF Y';
RUN;
MODEL M = X D E XD XE;
TITLE 'REG OF M';
QUIT;
THE ERROR MESSAGE IN LOG IS"only variables in the VAR statement or in MODEL statements prior to the first RUN statement are available"
Is there any wrong in my codes?
Thanks in advance.