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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 782 views
  • 0 likes
  • 4 in conversation