Date: Thu, 1 Feb 2001 00:23:29 GMT
Reply-To: Charles_S_Patridge@PRODIGY.NET
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Charles Patridge <Charles_S_Patridge@PRODIGY.NET>
Organization: Deja.com
Subject: Re: HOW TO DIRECT OUTPUT FILES BASED ON A VARIABLE IN DATASTEP?
Victor,
Paul's solution is very elegant and simple and therefore, I have posted
his solution to your question on my web site (http://www.sconsig.com )
as tip00234 so others can refer to it in the future.
HTH,
Charles Patridge
Email: Charles_S_Patridge@prodigy.net
In article <F39XUIEAOeIiGXix4A200000911@hotmail.com>,
sashole@bellsouth.net wrote:
> Victor,
>
> It should not be too difficult, just use the FILEVAR option on the
FILE
> statement. Something like this ( I assume your data are in the form of
a SAS
> data file):
>
> data a;
> input name $ stuff;
> cards;
> george 15
> george 20
> george 30
> victor 12
> victor 25
> victor 32
> david 21
> david 21
> david 35
> ;
> run;
>
> data _null_;
> length filevar $44;
> set a; by name notsorted;
> if first.name then filevar = 'e:\'||name;
> file out filevar=filevar;
> put @1 name $15. @ 16 stuff 2.;
> run;
>
> If you are working in the MVS environment, it would be cleaner to make
a
> preliminary run through the data set and create the list of file names
> first, kill them with the FILENAME counterpart of IEFBR14 using
> DISP=(MOD,DELETE) (that would require a macro or tempfile), and then
feed
> them to the FILEVAR variable on the second pass.
>
> Kind regards,
> =====================
> Paul M. Dorfman
> Jacksonville, Fl
> =====================
>
> >From: Kewei Ming
> >
> >I am have some trouble using SAS to generate text files for a ongoing
> >project. The dataset has the following format:
> >
> >george 15 george 20 george 30 victor 12 victor 25 victor 32 david 21
david
> >21 david 35 ... ... ...
> >
> >And this file is very long.
> >
> >I want to generate different files for different persons. I.e., I
want to
> >generate a file named 'george' that contains the following:
> >
> >george 15 george 20 george 30
> >
> >Now I know that there are something like 25000 names in the dataset,
also
> >each person has about 2000 observations. What is the right way to
direct
> >SAS to output to different output files dynamicly so that I can get
these
> >25000 files by running SAS datastep just once? I can't imagine going
> >through this huge dataset 25000 times, each generating only one small
> >file...
> >
> >There must be a way. I tried using call symput but failed to get it
to
> >work.
> >
> >All suggestions are welcome. Thanks. Please reply to fg5028@yahoo.com
or
> >post to this board.
> >
> >Victor
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com
>
--
Charles Patridge - PDPC, Ltd.
172 Monce Road - Burlington, CT 06013 USA
Phone: 860-673-9278 or 860-675-9026
Email: Charles_S_Patridge@prodigy.net - Web: www.sconsig.com
Sent via Deja.com
http://www.deja.com/
|