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 (December 2008, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 22 Dec 2008 03:01:26 -0800
Reply-To:     jesper@HVIDKILDEHUSENE.DK
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         jesper@HVIDKILDEHUSENE.DK
Organization: http://groups.google.com
Subject:      Splitting a large dataset
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset=windows-1252

Hi,

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:

Dataset: data Name: Data: Jens A Jens G Jens X Ole D Ole B

I want to split this into two datasets like this:

Dataset: jens Name: Data: Jens A Jens G Jens X

Dataset: ole Name: Data: Ole D Ole B

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.

Thank you, Jesper


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