BookmarkSubscribeRSS Feed
knighsson
Obsidian | Level 7

I run my code as follows:

 


data nh.outcomes_joint_wkd_ind;
set nh.outcomes_joint_wkd_ind;
if alpha50=. then eligible=2;
else eligible=1;
run;

 

 

***SLR;

 

PROC SURVEYREG DATA=nh.outcomes_joint_wkd_ind nomcar;
STRATA sdmvstra;
CLUSTER sdmvpsu;
CLASS alpha50;
WEIGHT glucwt4yr;
domain eligible;
model BMXBMI=alpha50/adjrsq clparm solution vadjust=none;
lsmeans alpha50/ lines adjust=tukey;
run;

 

 

 

***** MLR;

 

PROC SURVEYREG DATA=nh.outcomes_joint_wkd_ind nomcar;
STRATA sdmvstra;
CLUSTER sdmvpsu;
CLASS alpha50 age RIAGENDR PIR SDDSRVYR RIDRETH1;
WEIGHT glucwt4yr;
DOMAIN eligible;
model BMXBMI= age RIAGENDR PIR SDDSRVYR RIDRETH1 EIEER alpha50/adjrsq clparm solution vadjust=none;
lsmeans / lines adjust=tukey;
run;

 

But the log told me that for SLR:  All observations were omitted due to missing values or non-positive weights in domain eligible=2.

For MLR:  No observations in data set OUTCOMES_JOINT_WKD_IND.

 

I also checked the data set, and it contains 20470 observations. I know there is something wrong with my code, but I don't know where and how. So can you point out where I was wrong and howto fix it?

 

Thank you so much!

9 REPLIES 9
PaigeMiller
Diamond | Level 26

All observations were omitted due to missing values or non-positive weights in domain eligible=2.

 

I think this means that because of missing values or non-positive weights, the PROC SURVEYREG procedure cannot operate. ^You need to check your dataset for these problems.

 

No observations in data set OUTCOMES_JOINT_WKD_IND.

I also checked the data set, and it contains 20470 observations

What data set are you referring to that you checked and it contains 20470 observations? When SAS says the data set has no observations and the user says it has 20470, I believe SAS. So, please convince us that data set nh.outcomes_joint_wkd_ind has that many observations, by running PROC CONTENTS and showing us the top 10 lines or so.

 

Also, @knighsson, from now on we need to see the entire log for these steps ... the code, the NOTES, the WARNINGS, the errors, in other words everything in the log for these steps.

 

--
Paige Miller
knighsson
Obsidian | Level 7

Thank you for your respond, I would also trust SAS more than myself! I think something wrong with the eligible domain maybe. I attached the screen shots1.PNG2.PNG3.PNG 

4.PNG

knighsson
Obsidian | Level 7
I also found that when LOG mentioned the dataset as "OUTCOME_JOINT_WKD_IND" rather than "NH.OUTCOME_JOINT_WKD_IND". Maybe this is the reason why it has 0 observations? but how can I fix it?
ballardw
Super User

One: Please post log entries as text. Copy the text from the log and paste into a code box opened on the forum with the </> icon.

That way we can copy bits of the code and make suggested changes or simply highlight text. I know that I am not going to retype, very likely introducing new problems, lots of someone else's code.

 

Two: That short proc print output showing missing values for so many variables but not showing any of the variables actually used by your code does question the completeness of the data involved.

 

 

knighsson
Obsidian | Level 7
PROC SURVEYREG DATA=nh.outcomes_joint_wkd_ind nomcar;
387 STRATA sdmvstra;
388 CLUSTER sdmvpsu;
389 CLASS alpha50 age RIAGENDR PIR SDDSRVYR RIDRETH1;
390 WEIGHT glucwt4yr;
391 DOMAIN eligible;
392 model BMXBMI= age RIAGENDR PIR SDDSRVYR RIDRETH1 EIEER alpha50/adjrsq clparm solution vadjust=none;
393 lsmeans / lines adjust=tukey;
394 run;

ERROR: No observations in data set OUTCOMES_JOINT_WKD_IND.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SURVEYREG used (Total process time):
real time 0.47 seconds
cpu time 0.00 seconds


Thank you!
Patrick
Opal | Level 21

In your code you use if alpha50=. then eligible=2;

data nh.outcomes_joint_wkd_ind;
set nh.outcomes_joint_wkd_ind;
if alpha50=. then eligible=2;
else eligible=1;
run;

So I guess that means alpha50 is always missing for eligible=2.

And then your SurveyReg code uses alpha50 - which is always missing for eligible=2:

CLASS alpha50 age RIAGENDR PIR SDDSRVYR RIDRETH1;
WEIGHT glucwt4yr;
DOMAIN eligible;
model BMXBMI= age RIAGENDR PIR SDDSRVYR RIDRETH1 EIEER alpha50/adjrsq clparm solution vadjust=none;

 

Isn't that then exactly what the SAS Log tells you?

All observations were omitted due to missing values or non-positive weights in domain eligible=2

knighsson
Obsidian | Level 7
Yes, we divided participant into two domains, one is that participant has alpha50, one is that dont have alpha 50. So domain eligible =2 has all missing alpha50. but my issue is that when I run multiple linear regression, SAS cannot recognize the data set i used and told me there is no observations. But there are observations in previous step.
PaigeMiller
Diamond | Level 26

That's very odd. Doesn't make sense to me. But you still need to fix this missing value problem and negative weight problem, and then perhaps the problem will go away.

--
Paige Miller
knighsson
Obsidian | Level 7
Thank you all. So I found what went wrong. When I run the code of multiple linear regression, one of the variables, EIEER, has no values in all the participants. That's why it did not work. After the assigning values to EIEER, it worked out. Thank you all!

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 9 replies
  • 2343 views
  • 0 likes
  • 4 in conversation