PROC Print and Sort
(1) The PRINT procedure prints the observations in a SAS data set, using all or
some of the variables. A variety of reports can be created ranging from a simple
listing to a highly customized report that groups the data and calculates totals
and subtotals for numeric variables.
(2) VAR -Select variables that appear in the report and determine their
order
SPLIT -Specify the split character, which controls line breaks in column
headings
SUM -Total values of numeric variables
ID -Identify observations by the formatted values of the variables that
you list instead of by observation numbers
BY -Produce a separate section of the report for each BY group
(3) NOOBS -Suppress the column in the output that identifies each
observation by number
DOUBLE -Write a blank line between observations
OBS -Specify a column header for the column that identifies each
observation by number
WIDTH -Use each variable’s formatted width as its column width on all
pages
HEADING -Control the orientation of the column headings
(4) By using NODUPKEY in proc sort procedure
(5) TITLE ‘Title text goes here ‘;
FOOTNOTE ‘Footnote text goes here’;
(6) By using PAGEBY statement in Proc print procedure
(7) By using PROC SORT procedure.
Proc sort data=dataset-name;
By by-variable;
run;
(8) The following chart lists character data values can be sorted in ascending
order using proc sort procedure
(9)
options nodate nonumber ;
title 'Revenue and Expenses figures for each region';
proc sort data=test;
By Region state;
Run;
proc print data=test noobs;
ID Month;
format Month monyy5. Expenses comma8. Revenues comma8.;
By Region state;
sum Expenses Revenues;
sumby region;
run;
(10)
options nodate nonumber ;
title1 'Expenses Incurred for';
title2 'Salaries for Flight Attendants and Mechanics';
proc sort data=test;
By Job_Code Gender;
Run;
proc print data=test noobs split='.';
VAR Gender Salary;
ID Job_Code;
format Salary dollar12.;
label Job_Code='Job code.=========' Gender='Gender.========'
Salary='Annual Salary.=============';
By Job_Code;
sum Salary;
sumby Job_Code;
run;