Help using Base SAS procedures

Trouble with Columns using PROC REPORT

Reply
Occasional Contributor
Posts: 16

Trouble with Columns using PROC REPORT

Hi everyone; I'm a SAS rookie. I am using BASE SAS 9.2 and I've run into a problem. I have two mainframe data sets that I am trying read in and manipulate the data via columns. Would anyone know a simple way to use PROC REPORT or another method to manipulate the below data so that it shows the below

STORNAME ALLOC ALLOC
SEP09 DEC08
DATADB2 10.37 9.30


INPUT DATA

STORNAME ALLOC DATE
DATADB2 10.37 SEP09
DATAIMS 2.07 SEP09
EPOL 14.13 SEP09
FC DASD 50.46 SEP09
G1 23.87 SEP09
G2 4.31 SEP09
G3 33.08 SEP09
OBJDATA 2.11 SEP09
SYSTEMS 2.32 SEP09
XTVOLS 0.26 SEP09

STORNAME ALLOC DATE
DATADB2 9.30 DEC08
DATAIMS 2.20 DEC08
EPOL 27.50 DEC08
FC DASD 25.90 DEC08
G1 20.30 DEC08
G2 3.50 DEC08
G3 31.30 DEC08
OBJDATA 2.00 DEC08
SYSTEMS 4.40 DEC08
XTVOLS 0.26 DEC08
Super Contributor
Super Contributor
Posts: 3,174

Re: Trouble with Columns using PROC REPORT

SAS PROC REPORT with the GROUP and ACROSS options can create the report you demonstrated.

The Google advanced search argument will generate some matches, providing you SAS-hosted documentation and supplemental technical/conference references:

proc report group across site:sas.com


Scott Barry
SBBWorks, Inc.
SAS Super FREQ
Posts: 8,743

Re: Trouble with Columns using PROC REPORT

Hi:
First of all, PROC REPORT will not append your two data sets together. For PROC REPORT, it's one data set in and a report comes out. PROC REPORT will not do any "reading in" of multiple data sets. You'll have to do that with a DATA STEP program, PROC APPEND or PROC SQL.

However, what you want after the data sets are together, you could do with either PROC REPORT or PROC TABULATE. If you use PROC REPORT, then your DATE would be an ACROSS usage nested with ALLOC (DATE,ALLOC) and if you use PROC TABULATE, then DATE would be crossed with ALLOC (DATE*ALLOC) in the COLUMN dimension. Whether you use REPORT or TABULATE really depends on what other processing, if any, you need to do on your report. Grand Totals?? Sub Totals??? Calculated items??

A good place to start would be to look at some examples of PROC REPORT and PROC TABULATE in the documentation. There are a lot of examples to learn from. In addition, there have been many, many user group papers and forum postings on the topic of PROC REPORT and PROC TABULATE. Using all of those resources should give you some good code samples and some ideas of whether REPORT or TABULATE is the right choice.

cynthia
Ask a Question
Discussion stats
  • 2 replies
  • 95 views
  • 0 likes
  • 3 in conversation