PROC PRINT in SAS - What Does the PRINT Procedure Do
π What is PROC PRINT in SAS?
PROC PRINT is a SAS procedure that prints the observations in a SAS dataset to the output window. It provides a tabular view of your data and is commonly used for checking data during the data cleaning and analysis phase.
π§± Basic Syntax of PROC PRINT
Explanation:
PROC PRINTtells SAS to initiate the print procedure.DATA=dataset-namespecifies the dataset to print.RUN;executes the procedure.
π Example: Basic PROC PRINT
This code will output all rows and columns of the employees dataset.
π― Using PROC PRINT with SELECTED VARIABLES
You can use the VAR statement to print only specific columns from your dataset.
This will display only the Name and Department columns.
π’ Adding Row Numbers with ID Statement
The ID statement lets you replace the default observation number with a variable value.
Now, instead of row numbers (1, 2, 3), SAS will display the values from the ID column.
π§Ύ Using Labels in Output
To display more meaningful column headers, you can use labels.
Now the column header will display as Annual Salary.
π― Filtering Rows with WHERE Statement
The WHERE clause lets you filter records before printing.
This will display only the rows where the department is IT.
π More Useful Options
- OBS=number: Limits number of observations printed.
- NOOBS: Suppresses the default row number column.
- LABEL: Displays labels instead of variable names.
- TITLE: Adds a title to the output.
π‘ Best Practices for PROC PRINT
- Use
VARandIDto improve readability. - Always apply
WHEREclauses for large datasets. - Use
LABELfor user-friendly column headings in reports.
βHere are some More Examples for Proc print -
1. First Proc print to get the output for sasuser.admit dataset in output window
Code -
proc print data=sasuser.admit;run;
Labels: About SAS, Datahark, Proc Print, Procs, SAS

