BookmarkSubscribeRSS Feed
sree0203
Calcite | Level 5

Hi, 

 

Edition= Sas University Edition(9.4)

procedue=proc reg

data used contains categorical varaibles as 0/1 

 

code used=

 

proc reg data=Mylib.lineaf;
model revenue=Units_Sold Price mid tro dom;
output out=mylib.result predicted=p residual=r;
run;

 

/*where mid tro and dom contains varaibles as 0/1*/

 

Result encountering

 

The REG Procedure

  Number of Observations 89

Read Number of Observations 0

Used Number of Observations with Missing Values 89

 

 

But no further results are published  

Please help. not getting where exactly I am committing an error.

8 REPLIES 8
ballardw
Super User

Your issue comes from this message: Used Number of Observations with Missing Values 89

 

The procedure requires all variables on the model statement to be present. Any record that has one or more values missing for any of the independent variables is dropped from the calculation.

Apparently every record you have has at least one missing value for the independent variables in the model.

 

sree0203
Calcite | Level 5
But the output data shows that each of these variables mid tro dom are filled with either 0/1.I am not getting where the variables are missing
Reeza
Super User

One of the variables is missing for every observation. It doesn't have to be the variables you mentioned.

 

Run a proc means on your data to see which variables have missing values.

 

proc means data=have n nmiss;

run;

sree0203
Calcite | Level 5
I think every 0 in my variable data is appearing as missing variable.how to deal with it
Reeza
Super User

Fix your input data - if it should be 0, make sure it's 0, if it should be missing make sure it's missing.

 

It's possible that somehow the MISSING option is set to 0, but you would have to have explicitly changed the setting. See the line of code below to reset the values.

 

 

options missing=.;

 

sree0203
Calcite | Level 5
Yes I used this line in my previous code but later formatted them using format statement as nuemerics...i felt it worked but it seems it didnt....noe tell me how to breakthrough it
Reeza
Super User

@sree0203 wrote:
Yes I used this line in my previous code but later formatted them using format statement as nuemerics...i felt it worked but it seems it didnt....noe tell me how to breakthrough it

Ok. If your problem is resolved mark the question as solved, if not, indicate what the issue is outstanding. If you've tried something that didn't work please let me know.

ballardw
Super User

@sree0203 wrote:
Yes I used this line in my previous code but later formatted them using format statement as nuemerics...i felt it worked but it seems it didnt....noe tell me how to breakthrough it

Format and option missing display do not change underlying values.

 

something like:

data need;
   set have;
   array a _numeric_;
   do i=1 to dim(a);
      if missing(a[i]) then a[i]=0;
   end;
   drop i;
run;

to actually set the values to 0. Replace _numeric_ with an actual list of numeric variable names if desired.

 

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 8 replies
  • 1019 views
  • 0 likes
  • 3 in conversation