Date: Fri, 11 Sep 1998 01:34:51 GMT
Reply-To: shiling@MATH.WAYNE.EDU
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Shiling Zhang <shiling@MATH.WAYNE.EDU>
Organization: Deja News - The Leader in Internet Discussion
Subject: Re: Output based on Input
James,
transpose procedure seems very simple. After you have the output data, a
looping will generate a set of datasets you want.
hope this helps.
proc transpose data=t1 out=t2(drop=_name_) prefix=L;
by field1 field2;
id field4;
var field5;
run;
proc print; run;
output file;
****************;
OBS FIELD1 FIELD2 L10001 L10002 L10003
1 88888 67789 11111 22222 33333
2 99999 66999 44444 55555 .
In article <Ez1pKB.EMy@rc.gc.ca>,
"James Bennett" <bennettj@rc.gc.ca> wrote:
> Hello. Does anybody have an elegant solution to the following problem:
> I have data to be read in from a flat file and stored in different datasets
> based on a few of the fields read in.
> For example:
> Sample data to be read in:
> Field1 Field2 Field3 Field4 Field5
> 88888 67789 0100 10001 11111
> 88888 67789 0100 10002 22222
> 88888 67789 0100 10003 33333
> 99999 66999 0101 10001 44444
> 99999 66999 0101 10002 55555
>
> I need to read in each row one at a time and based on the value in Field3
> store the remaining fields in already existing datasets named "T"&Field3
> (ie:T0100 - rows 1 to 3 OR T0101 - rows 4 to 5). In addition Field4
> determines the field name in the dataset (ie: 10001 is field L10001).
> The result looks like the following:
>
> Dataset - T0100
> Field1 Field2 L10001 L10002 L10003
> 88888 67789 11111 22222 33333
>
> Dataset - T0101
> Field1 Field2 L10001 L10002
> 88888 67789 44444 55555
>
> I thought about constructing a dataset with a series of SQL Insert
> statements but I am not sure this is the way to go.
>
> *** Any help is very much appreciated. ***
>
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum