Grouping 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

Below is the output I needed

Item 			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 anyone help me on this, as this is critical.
Thanks in advance.

Regards,
Siddhartha
0
Reply msiddu2000 (20) 12/9/2010 5:37:45 PM

Hi

Would something like below help?

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;
  label prd_grp="Product" prd_subgroup="Product Subgroup"
prd_desc="Product Description"
        loan_amount="Loan Amount";
  keylabel all="Total" sum=" ";
  table (prd_grp all)*prd_subgroup*prd_desc,
loan_amount*sum*f=comma32.1
        /rts=50;
run;

Cheers
Patrick
0
Reply Patrick 12/9/2010 9:27:30 PM


On Dec 10, 2:27=A0am, Patrick <patrick.mat...@gmx.ch> wrote:
> Hi
>
> Would something like below help?
>
> 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=3Dhave noseps;
> =A0 class prd_grp prd_subgroup prd_desc;
> =A0 var loan_amount;
> =A0 label prd_grp=3D"Product" prd_subgroup=3D"Product Subgroup"
> prd_desc=3D"Product Description"
> =A0 =A0 =A0 =A0 loan_amount=3D"Loan Amount";
> =A0 keylabel all=3D"Total" sum=3D" ";
> =A0 table (prd_grp all)*prd_subgroup*prd_desc,
> loan_amount*sum*f=3Dcomma32.1
> =A0 =A0 =A0 =A0 /rts=3D50;
> run;
>
> Cheers
> Patrick

I am unable to get the desired output.
Can anyone help me on this, as this is critical requirement.
Thanks in advance
0
Reply msiddu2000 12/10/2010 3:37:09 PM

2 Replies
153 Views

(page loaded in 0.08 seconds)


Reply: