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.
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
@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;
I did run a proc freq on all variables and nothing came up missing
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;
I ran this code and got "Variable xxx in list does not match type prescribed for this list"
@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.
I did add /missing;
I have mixtures of character and numeric
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.
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;
ok thanks, I got "No observations in data set WORK.NOTUSED"
sorry, running SAS remotely and it's acting buggy
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
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!
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.