Writing Simple Text

Writing a Character String

In its simplest form, the PUT statement writes the character string that you specify to the SAS log, to a procedure output file, or to an external file. If you omit the destination (as in this example), then SAS writes the string to the log. In the following example, SAS executes the PUT statement once during each iteration of the DATA step. If SAS encounters missing values for the variables Year and Result, then the PUT statement writes a message to the log.
data _null_;
   length medalist $ 19;
   input year 1-4  medalist $ 6-24  medal $ 26-31 country $ 33-35 result 37-41; 
   if year=. then put '*** Missing Year';
      else
   if result=. then put '*** Missing Results'; datalines; 1984 Lingjuan Li SILVER CHN 2559 ...

Get Step-by-Step Programming with Base SAS 9.4 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.