LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 2003, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 9 Jan 2003 05:56:28 +0000
Reply-To:   sashole@bellsouth.net
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Paul Dorfman <paul_dorfman@HOTMAIL.COM>
Subject:   Re: grouping data
Comments:   To: ocerda@hotmail.com
Content-Type:   text/plain; format=flowed

Julius:

Why not? (The following assumes that once BHCID is the same, the rest of its satellites are the same. Else you would need to drop the references to the dup-killing array and sort by ID NAME ASSET RATING with NODUPKEY in an additional step).

data a ; input BHCID BHCNAME: $char8. BHCASSET: comma12. BHCRATING: $1. SUBSIDIARYID SUBNAME: $char8. SUBASSET: comma12. ; 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 ; run ;

data grouped ( keep = id name asset rating ) ; array used (0 : 100000) _temporary_ ; set a ; if not used (bhcid) then do ; used (bhcid) = 1 ; id = bhcid ; name = bhcname ; asset = bhcasset ; rating = bhcrating ; output ; end ; id = subsidiaryid ; name = subname ; asset = subasset ; rating = '' ; output ; run ;

Kind regards, ---------------- Paul M. Dorfman Jacksonville, FL ----------------

>From: Ceasar <ocerda@HOTMAIL.COM> >Reply-To: Ceasar <ocerda@HOTMAIL.COM> > >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

_________________________________________________________________ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail


Back to: Top of message | Previous page | Main SAS-L page