Date: Sat, 3 Dec 2005 11:49:31 -0800
Reply-To: rss <rslotpole@COMCAST.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: rss <rslotpole@COMCAST.NET>
Organization: http://groups.google.com
Subject: Re: do loops outside the data step
In-Reply-To: <he-dnfHYYJPwdQzeRVn-uw@rogers.com>
Content-Type: text/plain; charset="iso-8859-1"
Arthur,
Thanks. I can't claim to understand the code but I can play with it
and see what happens. My data files are now just text files so would I
just have to replace sas7bdat with the file extention? Also, I found
this code in the documentation:
You can also use the FILENAME statement to concatenate directories of
external files and to concatenate multiple individual external files
into one logical external file. These topics are discussed in Assigning
a Fileref to Concatenated Directories and Assigning a Fileref to
Concatenated Files .
The * and ? wildcards can be used in either the external file name or
file extension for matching input file names. Use * to match one or
more characters and the ? to match a single character. Wildcards are
supported for input only in the FILENAME and INFILE statements, and in
member-name syntax (aggregate syntax). Wildcards are not valid in the
FILE statement. The following filename statement reads input from every
file in the current directory that begins with the string wild and ends
with .dat:
*****************************
*****************************
filename wild 'wild*.dat';
data;
infile wild;
input;
run;
The following example reads all files in the current working directory:
***************************
***************************
filename allfiles '*.*';
data;
infile allfiles;
input;
run;
**************************
**************************
These examples look a lot easier but what I was really hoping for was
an answer that might look something like this:
Suppose you create a list of filenames e.g. exposure19891231.txt,
exposure19900131.txt,...exposure20050530.txt. Read all of these names
into variable called fname. Let's place them in a libref of
attribution.fname.
Data attribution.exposure
Set attribution.fname
Do loop on fname
Set fname
End do loop
Run;
I'm just learning sas so I have to clean up the syntax here but
hopefully you get the idea. Thanks again,