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 (January 2001, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 31 Jan 2001 11:56:40 -0500
Reply-To:   Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Subject:   Re: HOW TO DIRECT OUTPUT FILES BASED ON A VARIABLE IN DATASTEP?

I agree; FILEVAR= is exactly the right thing.

But with 25K names, I wonder about some other things.

1. Are the names unique, or are there perhaps records for different individuals having the same name, distinguished by some other variable?

2. Are all of the names valid as file names in the host environment. And even if they are, should some transformations be made to make them better behaved? I would probably replace embedded blanks with underscores and compress out any apostrophes.

3. Will the host OS react well to 25K sibling files at a single point in the file system?

On Wed, 31 Jan 2001 07:38:09 -0000, Paul Dorfman <paul_dorfman@HOTMAIL.COM> 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


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