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
On Wed, 31 Jan 2001 07:38:09 -0000, Paul Dorfman <paul_dorfman@HOTMAIL.COM>
>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
>input name $ stuff;
> 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.;
>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.
>Paul M. Dorfman
>>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
>>There must be a way. I tried using call symput but failed to get it to
>>All suggestions are welcome. Thanks. Please reply to firstname.lastname@example.org or
>>post to this board.
>Get your FREE download of MSN Explorer at http://explorer.msn.com