Date: Mon, 22 Dec 2008 03:01:26 -0800
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
Subject: Splitting a large dataset
Content-Type: text/plain; charset=windows-1252
I have a problem, which I hope you can help me solving.
I have one large dataset, which contains a column with a name and some
other columns with data belonging to the name. But there is not only
one row belonging to each name – there is about 20-50 rows.
The problem is that I want to split the dataset, so I have one dataset
for each name. A simple example to explain:
I want to split this into two datasets like this:
Immediately my idea was to create a new dataset containing all names
(in the example 1 column and 2 rows containing respectively Jens and
Ole). Then I would make a loop, which goes through each name and takes
out the data from the large dataset, where dataset.name = ”the name in
the loop right now”.
But I can’t figure out how to do it. Maybe I have to use arrays? But
as I see it, I have to write the names manually like this:
array name(2) Jens Ole;
This is not a problem as long as I only have two names, but when I
have 50+ it is.
There must be a way to do it?
I hope my question make sense – else just ask and I will try to
explain it better.