Date: Mon, 13 Nov 2000 16:09:07 GMT
Reply-To: Nigel Tufnel <dousk8@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Nigel Tufnel <dousk8@HOTMAIL.COM>
Subject: Explode Data Set
Content-Type: text/plain; format=flowed
Hi Y'all
I need to explode a sas data set a bit. Rather than explaining, I'll give
an example.
I have a data set something like the following:
ProdCode population owner list
101 c 1 a
102 c 1,2 b
103 c 1,2 c,d
104 c,h 2,3,4 d,e
I need to explode and repeat records (by prodcode) where there is more than
1 element in the field (seperated by commas)
ProdCode population owner list
101 c 1 a
102 c 1 b
102 c 2 b
103 c 1 c
103 c 2 c
103 c 1 d
103 c 2 d
104 c 2 d
104 h 2 d
104 c 3 d
104 h 3 d
104 c 4 d
104 h 4 d
104 c 2 e
104 h 2 e
104 c 3 e
104 h 3 e
104 c 4 e
104 h 4 e
As you can see the number of distinct records by prodcode ends up being the
product of all of the elements in the columns with more than one element.
Any ideas?
Thanks,
Nigel
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Share information about yourself, create your own public profile at
http://profiles.msn.com.