Skip to content. | Skip to navigation

Personal tools

Basic SAS Procedures - PROC PRINT

 

  • Prints a listing of the values of some or all of the variables in a SAS data set.
  • The PRINT procedure can be controlled by the following statements:
    • PROC PRINT options;
    • ID variable-list;
    • VAR variable-list;
    • BY variable-list;
    • PAGEBY by-variable;
    • SUMBY by-variable;
    • SUM variable-list;
  • Useful Options...
    • Print Statement Options

      Double - double spaces the printed output.
      Label - uses variable labels as column headings (variable name is default heading).
      Split='split character' - splits labels as column headings across multiple lines where split character appears.
      N - prints # of observations in data set at end of output. With BY statement, prints # in each group.
      Noobs - suppresses the observation number in the output.

              proc print data= test double label split= '*' n noobs;

    • "Special" Combination

      Assign ID and BY the same variable or set of variables to print...
      • Households

                proc print data= test; 
                   id VILLID HOUSEID; 
                   var PERSID GENDER AGE MAR; 
                  by VILLID HOUSEID; 
                run;

      • Observations with Duplicate Identifiers

                proc print data= test; 
                   id VILLID HHID PERSID; 
                   var GENDER AGE MAR;
                   by VILLID HHID PERSID; 
                run;


Another topic?

Questions or comments? If you are affiliated with the Carolina Population Center, send them to Phil Bardsley.