Grouping within columns

  • Follow


I  have four columns named prd_grp,prd-subgroup,prd_desc and
loan_amount.
The data is as follows:

prd_grp         prd_subgroup    prd_desc
loan_amount


ASSETS          All_Other
Loans                        234
ASSETS          All_Other
abc                           345
ASSETS          All_Other                       Quoted_Shares
213
LIABILIITES     Deposits                        Current_Deposs
435
LIABILIITES     Deposits
Fixed                        325
LIABILIITES     Deposits                        NIDs &
Repos            256
LIABILIITES     Deposits
Savings                         218

I want the output with Item,total and loan_amount columns:
Below is the output I needed


Item                       Total          Loan_amount


ASSETS
All_Other
Loans                                            234
abc                                               345
Quoted_Shares Held                      213
Total                                            692
LIABILIITES
Deposits
Current Deposits                          435
Fixed                                           325
NIDs & Repos                              256
Savings                                       218
Total                                          1234


Can anone help me on this,as this is critical.
Thanks in advance.
0
Reply msiddu2000 (20) 12/10/2010 3:40:40 PM

Hi

You've posted this question in different forums - and twice in this
one.

It would be kind of courtesy to reference such duplicates!

About your question: The code I've already posted did almost what you
asked for and needed only a small change.
I would expect that you put some energy in looking and understanding
answers as they might give you all the hints you need.

Don't just sit there and expect to be served!


data have;
input prd_grp:$12. prd_subgroup:$9. prd_desc:$20. loan_amount:8.;
datalines;
ASSETS All_Other Loans 234
ASSETS All_Other abc 345
ASSETS All_Other Quoted_Shares 213
LIABILIITES Deposits Current_Deposs 435
LIABILIITES Deposits Fixed 325
LIABILIITES Deposits NIDs_&_Repos 256
LIABILIITES Deposits Savings 218
;
run;


proc tabulate data=have noseps;
  class prd_grp prd_subgroup prd_desc;
  var loan_amount;
  keylabel all="Total";
  table prd_grp=''*prd_subgroup=''*(prd_desc='' all),
loan_amount*sum*f=comma32.
        /rts=50;
run;


HTH
Patrick
0
Reply Patrick 12/10/2010 11:50:47 PM


1 Replies
116 Views

(page loaded in 0.109 seconds)

Similiar Articles:













7/16/2012 6:44:33 AM


Reply: