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

Hi, wanted to inquire for some explanation on the usage of .z

 

I have interacted with its usage as shown in the code;

data lb1;
   length charval $200;
  set lb;
  if lborres >.z then do;
    charval=put(lborress,best.);
  end;
run;

 

  

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

.a to .z are "special" missing values. Although they all act like "normal" missing values in calculations, they do have an order, with .z being the "greatest", so .z is greater than .a or .

Using .z as the cutoff value makes sure that any "special" missing values can't make their way into the calculation:

See

data have;
input x1;
datalines;
.
.q
100
;

data want;
set have;
if x1 > . then x2 = 1 / x1;
if x1 > .z then x3 = 1 / x1;
run;
 73         data have;
 74         input x1;
 75         datalines;
 
 NOTE: The data set WORK.HAVE has 3 observations and 1 variables.
 NOTE:  Verwendet wurde: DATA statement - (Gesamtverarbeitungszeit):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 79         ;
 80         
 81         data want;
 82         set have;
 83         if x1 > . then x2 = 1 / x1;
 84         if x1 > .z then x3 = 1 / x1;
 85         run;
 
 NOTE: Missing values were generated as a result of performing an operation on missing values.
       Each place is given by: (Number of times) at (Line):(Column).
       1 bei 83:23   
 NOTE: There were 3 observations read from the data set WORK.HAVE.
 NOTE: The data set WORK.WANT has 3 observations and 3 variables.

View solution in original post

4 REPLIES 4
Kurt_Bremser
Super User

.a to .z are "special" missing values. Although they all act like "normal" missing values in calculations, they do have an order, with .z being the "greatest", so .z is greater than .a or .

Using .z as the cutoff value makes sure that any "special" missing values can't make their way into the calculation:

See

data have;
input x1;
datalines;
.
.q
100
;

data want;
set have;
if x1 > . then x2 = 1 / x1;
if x1 > .z then x3 = 1 / x1;
run;
 73         data have;
 74         input x1;
 75         datalines;
 
 NOTE: The data set WORK.HAVE has 3 observations and 1 variables.
 NOTE:  Verwendet wurde: DATA statement - (Gesamtverarbeitungszeit):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 79         ;
 80         
 81         data want;
 82         set have;
 83         if x1 > . then x2 = 1 / x1;
 84         if x1 > .z then x3 = 1 / x1;
 85         run;
 
 NOTE: Missing values were generated as a result of performing an operation on missing values.
       Each place is given by: (Number of times) at (Line):(Column).
       1 bei 83:23   
 NOTE: There were 3 observations read from the data set WORK.HAVE.
 NOTE: The data set WORK.WANT has 3 observations and 3 variables.
himself
Pyrite | Level 9
Thanks so so much @Kurt_Bremser, for the reply and for the example provided,I now understand how this works. Many thanks
FreelanceReinh
Jade | Level 19

In other words: For a numeric variable x the condition

x>.z

is a short way of checking for a non-missing value. This can also be coded in various other equivalent ways, e.g.,

not missing(x)

or

n(x)

Only in the absence of special missing values .a, ...,.z the condition x>. would be equivalent too, so x>.z is safer than that.

 

himself
Pyrite | Level 9
Thanks so so much @ FreelanceReinhard, for the response

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
  • 4 replies
  • 848 views
  • 2 likes
  • 3 in conversation