Specifying Lengths for Variables

Avoiding Truncated Variable Values

Although it is possible to add IF-THEN and ELSE statements to a DATA step in order to create the variable TestLength, consider what happens when you submit the following program:
data clinic.stress; 
   infile tests; 
   input ID $ 1-4 Name $ 6-25 RestHR 27-29 MaxHR 31-33
         RecHR 35-37 TimeMin 39-40 TimeSec 42-43
         Tolerance $ 45; 
   TotalTime=(timemin*60)+timesec; 
   retain SumSec 5400; 
   sumsec+totaltime; 
   if totaltime>800 then TestLength='Long'; 
   else if 750<=totaltime<=800 then TestLength='Normal'; 
   else if totaltime<750 then TestLength='Short'; 
run;
During compilation, when creating a new character variable in an assignment statement, SAS allocates as many bytes of storage space as there are ...

Get SAS Certification Prep Guide, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.