BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
wcw2
Obsidian | Level 7

I'm running a proc logistic model and getting the statement "NOTE: 27 observations were deleted due to missing values for the response or explanatory variables" yet none of my variables have missing values. Can someone tell me what's going on? Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
wcw2
Obsidian | Level 7

looks like I fixed it....my class statement had a bunch of unnecessary variables, so I removed them...didn't think it was not ok to put them there.....thanks all

View solution in original post

14 REPLIES 14
PaigeMiller
Diamond | Level 26

@wcw2 wrote:

I'm running a proc logistic model and getting the statement "NOTE: 27 observations were deleted due to missing values for the response or explanatory variables" yet none of my variables have missing values. Can someone tell me what's going on? Thanks.


Typically, when SAS says one thing and the user says the opposite, I believe SAS. Please run this code (appropriately modified with your data set name and with your variable names) and report the results:

 

proc summary data=yourdatasetname;
    var yourvariablenames;
    output out=nmiss nmiss=/autoname;
run;
proc print data=nmiss;
run;
--
Paige Miller
wcw2
Obsidian | Level 7

I did run a proc freq on all variables and nothing came up missing

StatDave
SAS Super FREQ

The best way to see how many observations are missing due to missing values on one or more variables involved in the model, list all variables specified in the procedure (response, predictors, weight, freq, offset, and so on) in the VAR statement of PROC MI step below. It provides a table that shows each pattern of missing values and the number of observations with that pattern.

ods select MissPattern;
proc mi data=<your_data> nimpute=0;
var <variables>;
run;
wcw2
Obsidian | Level 7

I ran this code and got "Variable xxx in list does not match type prescribed for this list"

PaigeMiller
Diamond | Level 26

@wcw2 wrote:

I ran this code and got "Variable xxx in list does not match type prescribed for this list"


Its a character variable, which you can't use in PROC SUMMARY.

 

I did run a proc freq on all variables and nothing came up missing

 

By default, PROC FREQ ignores missing values. You need to add the MISSING option. Please show us your code, and show us the output.

--
Paige Miller
wcw2
Obsidian | Level 7

I did add /missing;

djmangen
Obsidian | Level 7
I'm guessing that Variable xxx is a character variable.
wcw2
Obsidian | Level 7

I have mixtures of character and numeric

Reeza
Super User

You have missing most likely. Show your results from the following, changing your input_dsn data set name (class) only

 

*set input data set name;
%let INPUT_DSN = class;
%let OUTPUT_DSN = want;
*create format for missing;

proc format;
    value $ missfmt ' '="Missing" other="Not Missing";
    value nmissfmt .="Missing" other="Not Missing";
run;

*Proc freq to count missing/non missing;
ods select none;
*turns off the output so the results do not get too messy;
ods table onewayfreqs=temp;

proc freq data=&INPUT_DSN.;
    table _all_ / missing;
    format _numeric_ nmissfmt. _character_ $missfmt.;
run;

ods select all;
*Format output;

data long;
    length variable $32. variable_value $50.;
    set temp;
    Variable=scan(table, 2);
    Variable_Value=strip(trim(vvaluex(variable)));
    presentation=catt(frequency, " (", trim(put(percent/100, percent7.1)), ")");
    keep variable variable_value frequency percent cum: presentation;
    label variable='Variable' variable_value='Variable Value';
run;

proc sort data=long;
    by variable;
run;

*make it a wide data set for presentation, with values as N (Percent);

proc transpose data=long out=wide_presentation (drop=_name_);
    by variable;
    id variable_value;
    var presentation;
run;


title "Missing Report of &INPUT_DSN.";

proc print data=wide_presentation;
run;

 

And please show the log from the proc logistic regression.

 

StatDave
SAS Super FREQ

That PROC MI step is just for numeric variables. Try this instead: 

Add an OUTPUT statement to your LOGISTIC step to save the predicted values. In the resulting data set, the observations with either missing predicted value or missing response were not used. For example, these statements produce a data set, NotUsed, containing the observations there were not used. You can then print or view it to look for missing or invalid values that would cause each of them to be ignored.

proc logistic;
class x1;
model y = x1 x2 x1*x2;
output out=Pred p=p;
run;
data NotUsed;
set Pred;
if cmiss(of p y);
run;
wcw2
Obsidian | Level 7

ok thanks, I got "No observations in data set WORK.NOTUSED"

StatDave
SAS Super FREQ
Interesting... Please show the PROC LOGISTIC and DATA NotUsed steps you just ran that generated that message.
wcw2
Obsidian | Level 7

sorry, running SAS remotely and it's acting buggy

wcw2
Obsidian | Level 7

looks like I fixed it....my class statement had a bunch of unnecessary variables, so I removed them...didn't think it was not ok to put them there.....thanks 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!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 14 replies
  • 1881 views
  • 1 like
  • 5 in conversation