BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Phil_NZ
Barite | Level 11

Hi SAS Users,

 

I am new to SAS, so I have two questions disturbing me quite a bit:

 

1. With the code below:

data screen8;
   set aus_merge2;
   if  s3 ge 0;
run;

And there are some missing observations in variable s3 in dataset aus_merge2. I am wondering if, in dataset screen8, SAS will delete all observations smaller than 0 and all missing observation from aus_merge2?

 

2. In a linear regression using OLS:  y = ax1 + bx2  + cx3 +...

so, in the same observation, when any in y, x1,x2,x3, x4 is missing, the program will ignore totally this observation?

 

Many thanks and warm regards,

 
Thank you for your help, have a fabulous and productive day! I am a novice today, but someday when I accumulate enough knowledge, I can help others in my capacity.
1 ACCEPTED SOLUTION

Accepted Solutions
Shmuel
Garnet | Level 18

1) Numeric variable, missing value is the lowest value.

    You can check for missing value by:

       if var eq . then ... /* compare to a dot */
/* or by */
      if missing(var) then ...

  2) An outcome of computation with missing value is missing value,

     except  when using sum(of var1, var2, .....) then it will ignore missing

     values and treat then as zero, or in some procedures where you can

    choose an option how to treat missing value.

 

View solution in original post

5 REPLIES 5
Shmuel
Garnet | Level 18

1) Numeric variable, missing value is the lowest value.

    You can check for missing value by:

       if var eq . then ... /* compare to a dot */
/* or by */
      if missing(var) then ...

  2) An outcome of computation with missing value is missing value,

     except  when using sum(of var1, var2, .....) then it will ignore missing

     values and treat then as zero, or in some procedures where you can

    choose an option how to treat missing value.

 

Phil_NZ
Barite | Level 11

Hi @Shmuel ,

thank you for your dedicated answer. So, you mean, missing observation even smaller than negative value as you say it is the lowest value, did I explain you properly ?

 
Thank you for your help, have a fabulous and productive day! I am a novice today, but someday when I accumulate enough knowledge, I can help others in my capacity.
Shmuel
Garnet | Level 18

True, missing value is even smaller than any negative value.

 

 

Phil_NZ
Barite | Level 11

Hi @Shmuel ,

Thank you for your confirm, a further question is what is this code for ?

       if var eq . then ... /* compare to a dot */
/* or by */
      if missing(var) then ...

 Because of the missing observation will display ".", but why you let "..." compare to the dot ( I do not know why we need to compare to the dot) ? Thank you!

 
Thank you for your help, have a fabulous and productive day! I am a novice today, but someday when I accumulate enough knowledge, I can help others in my capacity.
Shmuel
Garnet | Level 18

A missing value is displayed as a dot without the quotation marks.

 

I use ...to say " add any wanted code " following the THEN.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

Discussion stats
  • 5 replies
  • 759 views
  • 3 likes
  • 2 in conversation