BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Junyong
Pyrite | Level 9

I saw Proc Reg several regressions with missing values that talks about multiple models with some missing ys. In short, proc reg with multiple models excludes observations with either y1 or y2 missing from all of its models. My case is opposite—my proc reg with multiple models has some x observations missing as follows.

data have;
do i=1 to 5000;
x1=rannor(1);
x2=rannor(1);
x3=rannor(1);
y=x1+x2+x3+rannor(1);
if ranbin(1,1,0.01) then x1=.;
if ranbin(1,1,0.01) then x2=.;
if ranbin(1,1,0.01) then x3=.;
output;
end;
run;

And I want to make each model in the following proc reg use all available observations.

proc reg noprint outest=want;
model y=x1;
model y=x2;
model y=x3;
model y=x1 x2;
model y=x1 x3;
model y=x2 x3;
model y=x1 x2 x3/edf;
quit;

I cannot apply the method above here because my model has different xs rather than ys. Is separating proc regs the only solution?

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

If by "separating" you mean a separate Proc reg call with a single model statement then pretty much yes.

 

From the documentation for Proc Reg:

PROC REG constructs only one crossproducts matrix for the variables in all regressions. If any variable needed for any regression is missing, the observation is excluded from all estimates. If you include variables with missing values in the VAR statement, the corresponding observations are excluded from all analyses, even if you never include the variables in a model. PROC REG assumes that you might want to include these variables after the first RUN statement and deletes observations with missing values.

 

 

View solution in original post

1 REPLY 1
ballardw
Super User

If by "separating" you mean a separate Proc reg call with a single model statement then pretty much yes.

 

From the documentation for Proc Reg:

PROC REG constructs only one crossproducts matrix for the variables in all regressions. If any variable needed for any regression is missing, the observation is excluded from all estimates. If you include variables with missing values in the VAR statement, the corresponding observations are excluded from all analyses, even if you never include the variables in a model. PROC REG assumes that you might want to include these variables after the first RUN statement and deletes observations with missing values.

 

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 878 views
  • 0 likes
  • 2 in conversation