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 (September 2008, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 11 Sep 2008 18:00:27 -0400
Reply-To:     Krishnan Viswanathan <krisviswanathan@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Krishnan Viswanathan <krisviswanathan@GMAIL.COM>
Subject:      Reading multiple datafiles
Content-Type: text/plain; charset=ISO-8859-1

I have zipped datafiles from all 50 US states that i want to read into SAS. For each state there are 3 data files giving me a total of 150 files. I was wondering if there is any method that will allow me to read the state abbreviation from a list, put it value in the appropriate place where the datafile is referred to in the code rather than creating a sas file for each state.

Any pointers are appreciated.

TIA, Krishnan

My code is below (using CA as an example. I am using [ ] just to make the state name stand out - the actual file name does not have these): /**********************/

filename census saszipam "D:\20061*[ca]*0098000.zip";

data *ca*_est;

infile census(e20061*[ca]*0098000.txt) DSD TRUNCOVER DELIMITER =',' LRECL=3072; INPUT {all variables}; run;

data *ca*_moe;

infile census(m20061*[ca]*0098000.txt) DSD TRUNCOVER DELIMITER =',' LRECL=3072; INPUT {all variables}; run;

data *ca*_se;

infile census(s20061*[ca]*0098000.txt) DSD TRUNCOVER DELIMITER =',' LRECL=3072; INPUT {all variables}; run;

-- Krishnan Viswanathan 1101 High Meadow Drive Tallahassee FL 32311 http://www.aidindia.org


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