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!
title1 'Total profit per year';
title2 'Separated by Product Line';
proc report data=sashelp.orsales nowd;
column year product_line,profit;
define year / group;
define product_line / across ;
define profit / analysis sum format=dollar15.2;
run;
1
title1 'Total profit per year';
2
title2 'Separated by Product Line';
3
PROC REPORTDATA=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.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.