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;
.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.
.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.
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.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.