BookmarkSubscribeRSS Feed
vatemro
Calcite | Level 5

Please can someone explain if the keyword missover or DSD can be used to label missing values that are not specified in a range? Thanks

5 REPLIES 5
RW9
Diamond | Level 26 RW9
Diamond | Level 26

No, that would be something you put into your code using if then or select statements.

if higher_bound < value then flag="High";

if lower_bount > value then flag="Low";

 

vatemro
Calcite | Level 5

So what is the keyword thta can be used to label a missing value and values that are not specified in a range.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

As I said, you would do this with conditional branching:

if higher_bound < value then flag="High";

if lower_bount > value then flag="Low";

 

MikeZdeb
Rhodochrosite | Level 12

Hi.  Another approach is to write your own INFORMAT to flag values as missing and/or out of an acceptable range as you read the data.  Here's an example using systolic blood pressure.  In case you did not know, there are 28 ways to indicate a mising value ... .A through .Z, plus ._ and the usual way of just a period ... Creating Special Missing Values

 

https://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a000992455.htm

 


proc format;
invalue sbp
 60-349  = _same_
  1-59   = .L
350-high = .H
   .     = .
;
value sbp
 60-120 = 'NORMAL'
120-139 = Prehypertension
140-159 = 'Hypertension/Stage 1'
160-349 = 'Hypertension/Stage 2'
   .L   = 'Out-of-Range/LOW'
   .H   = 'Out-of-Range/HIGH'
   .    = 'Missing'
;
run;

data x;
infile datalines dsd;
input sbp :sbp. @@;
datalines;
.,30,200,480,100,160,110,130,360,45,,150,152
;

 

proc freq data=x;
tables sbp / missing nocum;
format sbp sbp.;
run;


proc means data=x n nmiss mean maxdec=0;
var sbp;
run;

 

You can see that PROC FREQ will distinguish among the various types of missing values while all of the various missing values are ignored in PROC MEANS ...

 

                 sbp    Frequency     Percent
Missing                        2       15.38
Out-of-Range/HIGH              2       15.38
Out-of-Range/LOW               2       15.38
NORMAL                         2       15.38
Prehypertension                1        7.69
Hypertension/Stage 1           2       15.38
Hypertension/Stage 2           2       15.38

 

 

 Analysis Variable : sbp

         N
 N    Miss            Mean
 7       6             143

ballardw
Super User

A brief note on SAS lingo: Label is normally used to provide additional text for display of a variable name. Most procedures will display a variable label if assigned. Such as

Label mnwt = 'Mean weight at intake';

So when the variable mnwt is used in proc freq or a modeling procedure the text "Mean weight at intake" will be displayed so people don't have to try to decipher "mnwt".

 

Values of variables display are controlled by Formats to display a desired number of decimal points, currency symbols or to turn code values into full text to name a few bits.

 

There are times when misusing the lingo can lead to responses that do not address your problem.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1049 views
  • 0 likes
  • 4 in conversation