Barite | Level 11

## Comparing number with missing variable, and basic linear regression question

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
Garnet | Level 18

## Re: Comparing number with missing variable, and basic linear regression question

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.

5 REPLIES 5
Garnet | Level 18

## Re: Comparing number with missing variable, and basic linear regression question

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.

Barite | Level 11

## Re: Comparing number with missing variable, and basic linear regression question

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.
Garnet | Level 18

## Re: Comparing number with missing variable, and basic linear regression question

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

Barite | Level 11

## Re: Comparing number with missing variable, and basic linear regression question

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.
Garnet | Level 18

## Re: Comparing number with missing variable, and basic linear regression question

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

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

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