Programming the statistical procedures from SAS

Missing predicted values using proc plm after proc logistic

Reply
Occasional Contributor
Posts: 8

Missing predicted values using proc plm after proc logistic

proc logistic data=stat1.safety plots(only)=(effect oddsratio);
	class region (ref="Asia") size (ref="1")/ param=ref;
	model unsafe (event="1") = Weight Size Region;
	store out=issafe;
run;

data checkSafety;
   length Region $9.;
   input Weight Size Region $ 5-13;
   datalines;
   4 1 N America
   3 1 Asia     
   5 3 Asia     
   5 2 N America
	 ;
run;

proc plm restore=issafe;
	score data=checksafety out=safechecked / ilink;
run;

proc print data=safechecked;
run;

Hello Everyone, above is my code. I have attached the data set as well. 

 

I am getting missing values for the predicted values in the safechecked data set in proc plm. 

 

any ideas why the predicted variables are missing? 

 

Attachment
Super User
Posts: 23,771

Re: Missing predicted values using proc plm after proc logistic

[ Edited ]

Your checksafety data set is not being created correctly. You've specified 5-13 but then indented your data, so it actually starts at 9. So the region variable is truncated. I'm assuming you used the code clean up button or CTRL+I and it did it automatically? If so, I would consider this a bug in SAS tbh. I'm going to add it as a suggestion for improvement actually. 
EDIT: That's wrong, the auto code formatting doesn't do that. 

 

 


@amin1234 wrote:
proc logistic data=stat1.safety plots(only)=(effect oddsratio);
	class region (ref="Asia") size (ref="1")/ param=ref;
	model unsafe (event="1") = Weight Size Region;
	store out=issafe;
run;

data checkSafety;
   length Region $9.;
   input Weight Size Region $ 5-13;
   datalines;
   4 1 N America
   3 1 Asia     
   5 3 Asia     
   5 2 N America
	 ;
run;

proc plm restore=issafe;
	score data=checksafety out=safechecked / ilink;
run;

proc print data=safechecked;
run;

Hello Everyone, above is my code. I have attached the data set as well. 

 

I am getting missing values for the predicted values in the safechecked data set in proc plm. 

 

any ideas why the predicted variables are missing? 

 


 

 

Occasional Contributor
Posts: 8

Re: Missing predicted values using proc plm after proc logistic

@Reeza Thanks for your reply. I don't think it's the indentation. When the SELECTION= option is added to the model statement, the predicted values are not missing which is kind of strange. 

Super User
Posts: 23,771

Re: Missing predicted values using proc plm after proc logistic

Easy to check, check your input data set via proc print or opening it. That alone fixed it for me and as shown that data would read in correctly. 

 


@amin1234 wrote:

@Reeza Thanks for your reply. I don't think it's the indentation. When the SELECTION= option is added to the model statement, the predicted values are not missing which is kind of strange. 


 

 

SAS Employee
Posts: 386

Re: Missing predicted values using proc plm after proc logistic

The easiest way to fix this is to tell the INPUT statement to read the REGION variable until two blanks or the end of line is found. This is what & does. So, change your INPUT statement to this:

 

   input Weight Size Region &;
Ask a Question
Discussion stats
  • 4 replies
  • 82 views
  • 0 likes
  • 3 in conversation