SUPPORT / SAMPLES & SAS NOTES
 

Support

Usage Note 31366: Inserting a Blank Line After Every N Observations in PROC PRINT Output Using SAS 9.2

DetailsAboutRate It

Even beginning SAS programmers are familiar with PROC PRINT due to the minimal syntax required to produce simple listing reports. However, customized reports can be somewhat challenging. A basic listing report in which a blank line is inserted after every n rows may be a bit easier to read, but it is particularly challenging to create.

One traditional technique to solve this problem is to insert additional observations at a regular interval, each of which contains all missing values. The default display of a numeric missing value as a period is overridden by setting the MISSING system option to a blank.

     /* Insert blank observation after every 5 observations */
   data class_blanks;
     set sashelp.class;
     output;  /* Output real observation */
     if mod(_n_,5)=0;
     array allnums {*} _numeric_ ;
     array allchar {*} _character_ ;
     drop i;
     do i=1 to dim(allnums); allnums{i}=.; end;
     do i=1 to dim(allchar); allchar{i}=' '; end;
     output;  /* Output blank observation */
   run;
   options missing=' '; /* Display numeric missing as blank */
   proc print data=class_blanks noobs;
      title 'SASHELP.CLASS with Blank Line After Every 5 Obs';
   run;
   

One minor disadvantage to this approach is that the observation number column must be suppressed.

image label

The PRINT procedure supports the BLANKLINE= option in SAS 9.2. The simplest form of the option specifies the number of observations to display before each blank line.

The observation number column can be displayed with the BLANKLINE= option.

     /* The BLANKLINE option accomplishes the same result */
   proc print data=sashelp.class blankline=5;
      title 'SASHELP.CLASS with Blank Line After Every 5 Obs';
   run;

image label



Operating System and Release Information

Product FamilyProductSystemSAS Release
ReportedFixed*
SAS SystemBase SASz/OS9.2 TS1M0
Microsoft® Windows® for 64-Bit Itanium-based Systems9.2 TS1M0
Microsoft Windows Server 2003 Datacenter 64-bit Edition9.2 TS1M0
Microsoft Windows Server 2003 Enterprise 64-bit Edition9.2 TS1M0
Microsoft Windows XP 64-bit Edition9.2 TS1M0
Microsoft® Windows® for x649.2 TS1M0
Microsoft Windows 2000 Advanced Server9.2 TS1M0
Microsoft Windows 2000 Datacenter Server9.2 TS1M0
Microsoft Windows 2000 Server9.2 TS1M0
Microsoft Windows 2000 Professional9.2 TS1M0
Microsoft Windows Server 2003 Datacenter Edition9.2 TS1M0
Microsoft Windows Server 2003 Enterprise Edition9.2 TS1M0
Microsoft Windows Server 2003 Standard Edition9.2 TS1M0
Microsoft Windows XP Professional9.2 TS1M0
Windows Vista9.2 TS1M0
64-bit Enabled AIX9.2 TS1M0
64-bit Enabled HP-UX9.2 TS1M0
64-bit Enabled Solaris9.2 TS1M0
HP-UX IPF9.2 TS1M0
Linux9.2 TS1M0
Linux for x649.2 TS1M0
OpenVMS on HP Integrity9.2 TS1M0
Solaris for x649.2 TS1M0
* For software releases that are not yet generally available, the Fixed Release is the software release in which the problem is planned to be fixed.