BookmarkSubscribeRSS Feed
Calcite | Level 5
data outst_amt;
input prd_cat : $25. cus_cat & $20. Date_values & $20. Out_amount ;
Hire-Purchase Business-banking 25thaug2010 234
Housing-Loans Consumer-banking 26-Aug-2010 243
Credit-card Business-banking 26-Aug-2010 342
Personal-Loan Consumer-banking 25-Aug-2010 456
Co-op-Personal-Loan Business-banking 27-Aug-2010 356
Share-Margin-Financing Consumer-banking 28-Aug-2010 123
Revolving-Credits Business-banking 25-Aug-2010 213
Syndicated-Loans Consumer-banking 24-Aug-2010 432
Trade-Financing Business-banking 29-Aug-2010 124
Term-Loans Consumer-banking 31-Aug-2010 145
Overdraft Business-banking 25-Aug-2010 234
Other-loans Consumer-banking 26-Aug-2010 187

I want the output as follows:

Item Descriptions ------Date values------- 25-Aug 26-Aug 27-aug 28-Aug
A.Loans by Business Segment
Business banking 314 345
Consumer banking 234 213
Total Gross Loans

B.Gross Loans by Products
Hire Purchase 367 276
Housing Loans 342
Credit card
Personal Loan 243
Co-op Personal Loan
Share Margin Financing 234 567
Revolving Credits 546
Syndicated Loans
Trade Financing
Term Loans
Overdraft 345 657 546
Other loans
Total Gross Loans

Can anyone help me on this, as I was strucked from morning onwards.
Thanks in advance
Again, I see that you have posted this same question in the SAS Procedures forum.

If this question is about reporting (and it seems that it is), then it would be easier for everyone to only track the question(s) and answers in one forum. Pick a forum for your question, one forum is best.

It seems that you want some report output (as opposed to dataset output) so you might want to just leave this question in the ODS and Reporting forum.

Is this question at all related to your two previous questions:

The only difference that I see between this output and some of your previous output is that now, your desired output shows the dates going along the top of the report -- this is the type of report that you might be able to generate with PROC TABULATE.

However, I don't see the "A. Loans by Busienss Segment" and "B. Gross Loans by Product" in your data -- so to me this seems like another reason to use PROC REPORT with a COMPUTE BLOCK and a LINE statement to write customized headers. A simple modification of one of the programs that's already been posted in your other forum would allow you to write a custom header before a group. Or, you could use PROC TABULATE with custom BOX labels to put these "extra" report headers. Since I already posted a PROC REPORT program for you, I am posting a TABULATE program to help you get started.

This actually looks like 2 different summaries...the top of your desired report looks like a summary of the CUS_CAT variable and the bottom half of your desired reports looks like a summary of the PRD_CAT variable.

Perhaps it is time to take a step back and learn a bit more about SAS reporting procedures like PROC REPORT and PROC TABULATE in order for you to figure out which one of these would give you the desired result. If you search the forums, you will find a lot of previous postings with links to user-group papers about the use of PROC REPORT and PROC TABULATE. Perhaps those will get you started.

data outst_amt;
length prd_cat $25 cus_cat $20 ;
infile datalines dsd dlm=',';
input prd_cat $ cus_cat $ Date_values : anydtdte. Out_amount ;
"Hire Purchase","Business banking","25-aug-2010",234
"Housing Loans","Consumer banking","26-aug-2010",243
"Credit card","Business banking","26-aug-2010",342
"Personal Loan","Consumer banking","25-aug-2010",456
"Co-op Personal Loan","Business banking","27-aug-2010",356
"Share Margin Financing","Consumer banking","28-aug-2010",123
"Revolving Credits","Business banking","25-aug-2010",213
"Syndicated Loans","Consumer banking","24-aug-2010",432
"Trade Financing","Business banking","29-aug-2010",124
"Term Loans","Consumer banking","31-aug-2010",145
"Overdraft","Business banking","25-aug-2010",234
"Other loans","Consumer banking","26-aug-2010",187

ods listing;
proc print data=outst_amt;
title 'what does data look like';
format date_values date6.;

ods listing close;
ods html file='c:\temp\two_tables.html' style=sasweb;

options missing = 0;
proc tabulate data=outst_amt;
class date_values / order=internal;
class prd_cat cus_cat / order=data;
var out_amount;
table cus_cat all='Total Gross Loans',
date_values*out_amount=' '*sum /
box='A. Loans by Business Segment';

table prd_cat all='Total Gross Loans',
date_values*out_amount=' '*sum /
box='B. Gross Loans by Product';

format date_values date6.;
label prd_cat='Item Descriptions'
cus_cat='Item Descriptions'
date_values='Date Values';
keylabel sum=' ';
ods html close;


Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.


Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 1 reply
  • 2 in conversation