| Date: | Wed, 3 Nov 1999 09:38:49 -0500 |
| Reply-To: | "Steven M. Belz" <nbelz@VT.EDU> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | "Steven M. Belz" <nbelz@VT.EDU> |
| Organization: | Virginia Tech, Blacksburg, Virginia, USA |
| Subject: | Generating Variable Filenames |
|---|
Apologies for the longish nature of this post, but am having difficulty
with the following - any sage advice would be useful:
What I have: A data file with multiple fields, one of which is named
'Event' and each event has multiple observations. The data file is
sorted by event.
What I would like to do: Split this long file into multiple, smaller
files where each event is contained within its own file.
The Catch: I would like SAS to automatically name the file according to a
naming convention I develop. Specifically, assigning a name to the file
within a loop.
Illustration: Here is a simplified dataset from subject #1.
Event EvType DataPoint1 DataPoint2
1 2 567 54.3
1 2 657 65.2
2 5 543 34.6
2 5 872 75.2
3 2 345 34.5
3 2 875 87.5
From this I would like to generate the following files with the naming
convention such that SX is the subject number, EX is the EvType, and NX
is the numbered occurrence of the EvType.
File 1: S01E2N01.dat
1 2 567 54.3
1 2 657 65.2
File 2 S01E5N01.dat
2 5 543 34.6
2 5 872 75.2
File 3 S01E2N02.dat (NOTE: N02 is because this is the second occurrence
of an EvType 2)
3 2 345 34.5
3 2 875 87.5
Again, any advice would be greatly appreciated.
Thanks,
Steven Belz
nbelz@vt.edu
|