Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.z syntax in SAS

Tags:

sas

I found this paper on SAS that includes (on the first page and some other parts) the following line of code:

if trt1pn > .z then...

I was wondering what the purpose of it can be. I had never seen the ".z" expression before. I though (and some colleagues of mine thought the same) it was a typo. But you can do

data kk;
   a = .z;
   b = .b;
run;

and you get variable a equal to "Z" and variable b equal to "B".

Where in the SAS manuals is this discussed? What can it mean? Why is it used in the paper in such way?

like image 501
datanalytics.com Avatar asked Aug 28 '10 20:08

datanalytics.com


2 Answers

SAS has 28 different missing values (., ._, .A-.Z) with '.' being the default. these special missing values can be set based on the reason the value is missing. Is the data point not applicable, then '.N' could be used.

Additionally, these missing values can be formatted via custom formats (proc format) easily.

Proc format;
  Value Response
    1='Yes'
    0='No'
    .U='Unsure'
    .N='Not Applicable'
    .R='Refused to Answer';
Run;
like image 158
rkoopmann Avatar answered Sep 24 '22 08:09

rkoopmann


For a numeric variable, there are 28 different missing values (._, ., .A, .B, ... ,.Z). They are "smaller" than all numbers. Among them, the smallest is the dot-underscore(._) and the largest the dot-Z(.Z). Thus, the line:

if trt1pn > .Z then ...

can be re-written using the missing() function:

if not missing(trp1pn) then ...

which is a bit clearer.

like image 40
Chang Chung Avatar answered Sep 21 '22 08:09

Chang Chung