Testing Your Programs

Limiting Observations

Remember that you can use the OBS= option in the INFILE statement to limit the number of observations that are read or created during the execution of the DATA step.
data perm.update;
   infile invent obs=10;
   input Item $ 1-13 IDnum $ 15-19 
         InStock 21-22 BackOrd 24-25; 
   Total=instock+backord;  
run;
When processed, this DATA step creates the perm.update data set with variables but with only ten observations.

PUT Statement

When the source of program errors is not apparent, you can use the PUT statement to examine variable values and to print your own message in the log. For diagnostic purposes, you can use IF-THEN/ELSE statements to conditionally check for values. You can learn about IF-THEN/ELSE ...

Get SAS Certification Prep Guide: Base Programming for SAS 9, Third 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.