Date: Thu, 9 Jan 2003 08:45:23 -0800
Reply-To: "Huang, Ya" <yhuang@AMYLIN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Huang, Ya" <yhuang@AMYLIN.COM>
Subject: Re: grouping data
Content-Type: text/plain; charset="iso-8859-1"
The following version slightly differs from Paul's array one.
It use traditional "by + first." processing technique:
data xx;
input BHCID BHCNAME $ BHCASSET :comma. BHCRATING SUBSIDIARYID SUBNAME $ SUBASSET :comma.;
cards;
1999 NABHC 1,590,940 2 1001 NABBK1 1,000
1999 NABHC 1,590,940 2 1002 NABBK2 2,000
1999 NABHC 1,590,940 2 1003 NABBK3 900
2999 BBBHC 2,499,940 3 2001 BBBBK1 400
2999 BBBHC 2,499,940 3 2002 BBBBK2 1,000
3999 AABHC 1,700,000 1 3003 AAABK3 100
;
data xx;
set xx;
by BHCID BHCNAME BHCASSET;
if first.bhcasset then output;
BHCID=SUBSIDIARYID;
BHCNAME=SUBNAME;
BHCASSET=SUBASSET;
BHCRATING=.;
output;
drop SUBSIDIARYID SUBNAME SUBASSET;
run;
options nocenter;
proc print;
run;
-------------
Obs BHCID BHCNAME BHCASSET BHCRATING
1 1999 NABHC 1590940 2
2 1001 NABBK1 1000 .
3 1002 NABBK2 2000 .
4 1003 NABBK3 900 .
5 2999 BBBHC 2499940 3
6 2001 BBBBK1 400 .
7 2002 BBBBK2 1000 .
8 3999 AABHC 1700000 1
9 3003 AAABK3 100 .
Kind regards,
Ya Huang
-----Original Message-----
From: Ceasar [mailto:ocerda@HOTMAIL.COM]
Sent: Wednesday, January 08, 2003 8:55 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: grouping data
I have the following data that i would like to group as follows:
BHCID BHCNAME BHCASSET BHCRATING SUBSIDIARYID SUBNAME SUBASSET
1999 NABHC 1,590,940 2 1001 NABBK1 1,000
1999 NABHC 1,590,940 2 1002 NABBK2 2,000
1999 NABHC 1,590,940 2 1003 NABBK3 900
2999 BBBHC 2,499,940 3 2001 BBBBK1 400
2999 BBBHC 2,499,940 3 2002 BBBBK2 1,000
3999 AABHC 1,700,000 1 3003 AAABK3 100
(and so on.......)
GROUPED AS FOLLOWS
1999 NABHC 1,590,940 2
1001 NABBK1 1,000
1002 NABBK2 2,000
1003 NABBK3 900
2999 BBBHC 2,499,940 3
2001 BBBBK1 400
2002 BBBBK2 1,000
3999 AABHC 1,700,000 1
3003 AAABK3 100
(and so on........)
Is it possible to create a data set in this format? Or would one have to do
this in a 'report'? I normally like to export my results into excel.
Any help would be great...
post or email to ocerda@hotmail.com
|