Date: Fri, 26 Sep 2008 05:47:15 -0700
Reply-To: "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET>
Subject: Re: How to Read Row Oriented External Files?
Content-Type: text/plain; charset=windows-1252
On Sep 26, 2:35 am, siigm...@yahoo.com wrote:
> How to Read Row Oriented External Files?
> I have a txt file where all the information is stored in one row. On
> record contains 152 variables separated by space. The first record
> starts at several positions into the line, position 1970 and lasts
> until 3339. The following records have the same length as the first
> Normally, in the external files I have to read into SAS, the records
> are stored one in each row. For that purposes the following program is
> DATA out1_9;
> INFILE "f:\SAS\out1.dat" LRECL=3939 FIRSTOBS=1;
> @1970 t1 6.
> @1976 t2 13.5
> @1989 t3 13.5
> @3926 t152 13.5
> All on one long line:
> nspec = 6…………… 1 0.00000 50.11175 0.00000 0.00000
> 2 0.00000 50.11175 0.00000 0.0000…..
> The obstacle is to modify this program or make another program to
> repeat along the row by a %DO sentence/loop.
There is no need for macro here. The input @ operator accepts a
variable name, so you can manipulate the value of that variable to
dynamically change where you are inputting from.
This will read three fixed sized records that are in the same input
do count = 1 to 3;
Richard A. DeVenezia