BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi

How can I display report where i have two values 'Number of Invoices Received'
and 'Number of Invoices Autopass' in a datasets with only these columns in the datasets.


Report Output

Report header

Number of Invoices Received : 800
Number of Invoices Autopass :1000

Report footer

Which type of task or which type of Proc will give me the above output. Message was edited by: Sunil Gandhi
3 REPLIES 3
Cynthia_sas
SAS Super FREQ
Hi:
Assuming that your data looks like this with only 2 columns and 1 row:
[pre]
Obs numrec numauto
1 800 1000
[/pre]
Then you could use PROC TRANSPOSE on your data:
[pre]
proc transpose data=twocols out=trans;
label numrec = "Number of Invoices Received"
numauto = "Number of Invoices Autopass";
format numrec numauto comma6.;
run;

ods listing;
ods html file='show_trans.html' style=egdefault;

proc print data=trans;
title 'Transposed Report "Header" ';
footnote 'Transposed Report "Footer" ';
var _NAME_ _LABEL_ COL1;
run;

ods _all_ close;
[/pre]
And then the output from the above PROC PRINT would look like this:
[pre]
Transposed Report "Header"

Obs _NAME_ _LABEL_ COL1
1 numrec Number of Invoices Received 800
2 numauto Number of Invoices Autopass 1,000






Transposed Report "Footer"

[/pre]
Enterprise Guide does have a TRANSPOSE task, you could use that to transpose the data before the PROC PRINT or LIST Data task. And, of course, you could only use _LABEL_ and COL1 in the PROC PRINT or LIST Data task to get closer to the report you want.

There are two other alternative that don't use PROC TRANSPOSE. One involves using PROC TABULATE (Summary Table Task) and the other involves using a DATA step program to write the report to FILE PRINT ODS.

cynthia
deleted_user
Not applicable
Thanx a million,
But I dont want to display the column header i.e. want to suppress column header
for example:-
In your above output you are getting this
Obs _NAME_ _LABEL_ COL1
How to suppress this?
Cynthia_sas
SAS Super FREQ
Hi:
In that case, on of your choices is to move to a code node and use a PROC REPORT step with the NOHEADER option on the transposed data set:
[pre]
proc report data=trans nowd noheader;
title 'PROC REPORT: Transposed Report "Header"';
footnote 'Transposed Report "Footer"';
column _LABEL_ COL1;
run;
[/pre]

The other choices involve using a DATA step program.
cynthia

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 588 views
  • 0 likes
  • 2 in conversation