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 (May 1999, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 14 May 1999 11:37:08 -0400
Reply-To:     Myra.Oltsik@RESPONSEINSURANCE.COM
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         Myra Oltsik <Myra.Oltsik@RESPONSEINSURANCE.COM>
Subject:      Re: Reading Two Flat Files of Differing Lengths at Once
Comments: To: sas-l@listserv.uga.edu
Content-type: text/plain; charset=us-ascii

Thanks to Nathaniel Woodling, Peter Crawford, Tim Berryhill, and Gerry for their initial replys. I've followed their advice (as Gerry outlines below), but am still having a problem. For testing, I added OPTIONS OBS=10000. I'm getting the following note:

NOTE: 4474 records were read from the infile L018500. NOTE: 10000 records were read from the infile W018500. NOTE: The data set WORK.CART has 0 observations and 234 variables. NOTE: The data set WORK.RT has 0 observations and 234 variables. NOTE: The DATA statement used 2.95 CPU seconds and 4411K.

From running this program once for each INFILE I know there should records in each dataset, so I must still be doing something wrong.

Tim was right. I added the PUT _N_; statement after the INPUT -- and before the RETURN; and got a whole lot of ones:

1 1 1 1 1 1 <more>

What now?

"Gerry" <gpauline@fsmail.pace.edu> on 05/14/99 06:59:06 AM

To: Myra Oltsik/RS/NY/DRC@DRC cc:

Subject: Re: Reading Two Flat Files of Differing Lengths at Once

Myra:

Take the "RETURNS" out of your loops. Code your routine this way:

DATA CART RT;

INFILE L018500 LRECL=700 END=LOSS_EOF; DO While (^LOSS_EOF); LINK INN; END;

INFILE W018500 LRECL=610 END=PREM_EOF; DO While (^PREM_EOF); LINK INN; END;

Stop ;

Return ;

INN: /* Code */ Return ;

I assume that your record layouts are the SAME (ie.: the file's DCB information is different, but the record layout is the same) as far as the variables you are interested in goes.

Also, when controlling the read loop (do while, etc -- I prefer "do while" to "do until"), always remember to explicitly stop the DS with the "Stop ;" statement.

Hope this helps !

-Gerry

Gerard T. Pauline Mgr, Internet Applications Computer Systems, DoIT Pace University

> Date: Fri, 14 May 1999 10:07:14 -0400 > Reply-to: Myra.Oltsik@RESPONSEINSURANCE.COM > From: Myra Oltsik <Myra.Oltsik@RESPONSEINSURANCE.COM> > Subject: Reading Two Flat Files of Differing Lengths at Once > To: SAS-L@UGA.CC.UGA.EDU

> Usually, I get succinct help from SI. This time, however, it was too > succinct. The following is a slight modification of a tech support > question I sent to SI. I was sent TS581, which really didn't address my > problem. Maybe you guys can help, please. > > I'm trying to read in two different files with long record lengths. Each > file has over 150 variables, so I don't want to repeat the input lines. > I've read in two files before, but they had the same lengths and just a > few variables so I just repeated the code. Can I avoid that here? All the > data step edits refer to both INFILE filenames. > > Nothing I've done has worked. I've tried EOF= instead of END=, but don't > think I'm using that correctly. I can't find any example for EOF=. I've > also considered FILEVAR=, but again can't find a relavent example. Here, > I'm not sure if the LINK is the problem or not. > > Please help. Thank you. > > Myra > > ================================================================== > DATA CART RT; > > INFILE L018500 LRECL=700 END=LOSS_EOF; > DO UNTIL (LOSS_EOF); > LINK INN; > RETURN; > END; > > INFILE W018500 LRECL=610 END=PREM_EOF; > DO UNTIL (PREM_EOF); > LINK INN; > RETURN; > END; > > INN: > INPUT > @ 1 STATE $CHAR2. > @ 3 COMPANY $CHAR2. > @ 5 POLICYNO $CHAR8. > @ 15 PEFFDATE $CHAR8. > @ 15 PEFFYYMM $CHAR6. > @ 15 PEFFYYYY $CHAR4. > @ 19 PEFFMMDD $CHAR4. > @ 19 PEFFMM $CHAR2. > @ 21 PEFFDD $CHAR2. > @ 23 PEXPDATE $CHAR8. > @ 23 PEXPYYMM $CHAR6. > << more variables >> > @; > IF TRANTYPE = '1' THEN > INPUT > @ 33 TEFFDATE $CHAR8. > @ 41 TEXPDATE $CHAR8. > @ 60 LASTAMND $CHAR4. > @ 77 WRITPREM PD6.2 > ; > ELSE > INPUT > @ 33 TRANDATE $CHAR8. > @ 41 ACCYYYY $CHAR4. > @ 60 FILLER1 $CHAR4. > @ 77 LOSS_AMT PD6.2 > @ 611 CLAIM_NO $CHAR11. > @ 622 LINE_NO $CHAR2. > @ 691 ALTCLMCT $CHAR1. > @ 692 FILLER2 $CHAR9. > ; > > << more statements >> > > IF STATE EQ '04' THEN OUTPUT CART; > ELSE OUTPUT RT; > > RUN; >


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