LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (April 2005, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 5 Apr 2005 10:53:03 -0400
Reply-To:   "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Subject:   Re: Templates, regular expressions, resolutions and callbacks
Comments:   To: Chang Chung <chang_y_chung@HOTMAIL.COM>

On Tue, 5 Apr 2005 10:43:10 -0400, Chang Chung <chang_y_chung@HOTMAIL.COM> wrote:

>But nothing's impossible in SAS, it seems. Here is one way -- yeah, it is >much uglier and it generates a warning "symbolic reference AMP not >resolved." This means that if you are using any macro variable whose name is >the same as the name of a HTML entiry, then it will mess up the generated >code... oh well... > >Cheers, >Chang

Chang:

Here is a less icky, yet still excessive way. It does looping with prxNext, prxChange and TranWrd. Presumes the template does not contain the sequence <resolved>.

data _null_; infile template; file resolved;

if _n_ = 1 then rx = prxParse ('s:<macro>(.*?)</macro>:<resolved>:i');

retain rx;

input;

start = 1; stop = -1; call prxNext (rx,start,stop,_infile_,pos,len);

do while (pos);

call prxposn (rx,1,xpos,xlen); expression = substr(_infile_,xpos,xlen); expressionResolved = resolve (expression);

call prxChange (rx,1,_infile_); _infile_ = tranwrd (_infile_, '<resolved>', trim(expressionResolved));

start = pos + length(expressionResolved); call prxNext (rx,start,stop,_infile_,pos,len);

end;

put _infile_; run;


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