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 2003, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 30 Sep 2003 16:00:04 -0700
Reply-To:     Harmeet <hkalra@WEBGABLE.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Harmeet <hkalra@WEBGABLE.COM>
Organization: http://groups.google.com
Subject:      Re: Re-Reading same infiles in  a Datastep in SAS
Content-Type: text/plain; charset=ISO-8859-1

Actually I need to process the template file(s) 100s of time. This template is basically a cover letter. With program I need to update the templates with the information from my datafile for every customer and print it. There are multiple coverletter templates based on the request types.

Here is test code which is still not working after first read the template file is not read again even though I reset the 'END' var:

DATA MODIFIED; SET MASTER (IN=MASTER); BY REQREFN; RETAIN LN 0;

IF FIRST.REQREFN THEN DO; ENDSCUST = 0; FILE LOG; PUT ENDSCUST= REQREFN= REQTYPE= RPTTYPE=;

SELECT; WHEN (REQTYPE=1 AND RPTTYPE = 'S') LINK L_STDCUST; ** Same Link used for testing purposes .....; WHEN (REQTYPE=2 AND RPTTYPE = 'S') LINK L_STDCUST; OTHERWISE STOP; END; END; END; RETURN;

L_STDCUST: ENDSCUST = 0; RETAIN LN 0;

LN = 0;

PUT 'IN LINK BEFORE LOOP ' LN= REQREFN= ENDSCUST=;

DO UNTIL(ENDSCUST); INFILE STDCUST END=ENDSCUST; LN = LN+1;

INPUT #LN;

FILE LOG; PUT 'IN THE LOOP' LN= REQREFN=; PUT _INFILE_;

POS = INDEX(_INFILE_, '@');

IF POS THEN DO; SELECT; WHEN (INDEX(_INFILE_,'@#B')) SUBSTR(_INFILE_,POS) = PUT(ADDRLN1, $CHAR42.); WHEN (INDEX(_INFILE_,'@%C')) SUBSTR(_INFILE_,POS) = PUT(ADDRLN1, $CHAR42.); WHEN (INDEX(_INFILE_,'@%C')) SUBSTR(_INFILE_,POS) = PUT(CUSTNAME, $CHAR42.); WHEN (INDEX(_INFILE_,'@%K')) SUBSTR(_INFILE_,POS) = PUT(REQREFN, $CHAR23.); OTHERWISE; * NO MODIFICATIONS; END; END;

FILE STDCUSTO NOTITLES;

PUT _INFILE_; END;


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