Published on :
Reporting SASHELP

Report of profits by year and product line

This code is also available in: Deutsch Español Français
This script uses the REPORT procedure to create a crosstabulation from the `sashelp.orsales` table. It groups the data by year (`year`) and transposes the product line (`product_line`) into columns to display the sum of profits (`profit`) formatted in dollars.
Data Analysis

Type : SASHELP


Uses the standard `sashelp.orsales` table provided with the SAS installation.

1 Code Block
PROC REPORT
Explanation :
Report configuration with PROC REPORT: grouping by year, horizontal breakdown by product line, and summation of profits.
Copied!
1title1 'Total profit per year';
2title2 'Separated by Product Line';
3PROC REPORT DATA=sashelp.orsales nowd;
4 column year product_line,profit;
5 define year / group;
6 define product_line / across ;
7 define profit / analysis sum FORMAT=dollar15.2;
8 RUN;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.