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 2005, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 10 May 2005 09:51:22 -0400
Reply-To:     harry.droogendyk@RBC.COM
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Harry Droogendyk <harry.droogendyk@RBC.COM>
Subject:      Re: Embedding code that contains % via %include
Content-Type: text/plain; charset="iso-8859-1"

See Ian's idea for a similar situation:

http://listserv.uga.edu/cgi-bin/wa?A2=ind0505b&L=sas-l&F=&S=&P=11681

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU]On Behalf Of Greenwood, Nigel EDS-DWP Sent: Tuesday, May 10, 2005 9:33 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Embedding code that contains % via %include

Hi List,

(OS: z/OS V1.4 SAS V8.2) I have a (not large) piece of PROC SQL code which I would like to customise at run time based on some environmental specific code. I have 4 of these environments and YES it would be quite easy to clone the code and have 4 versions.

I have an idea about solving it but it seems heavy handed and before you switch-off is there any rational solution to the following?:

The nature of the environmental customisation involves a complex CASE statement that uses the LIKE predicate to examine for and map 20-30 input patterns to an output group. The input values are not 'patterned' identically and percents signs or underscores can appear in any of the eight character positions. The patterns don't 'convert' very easily to a user format.

I opted for the following type of code construct:

A source member (MYCODE): MACRO _mycode when infldc like 'ABC%123' then 'Group1' when infldc like '%XXXX' then 'Group2' otherwise 'Groupz' %

The inline code: %include lib(mycode);

proc sql ; Select date, inflda, infldb, case _mycode end as groupid from myfile where date between x and y; quit; run;

The failure occurs at the point of the %include when the compiler attempts to compile the partial case statement, presumably having seen the embedded % sign , stops the MACRO _Mycode scan and presumably starts looking for another valid token.

My thought is to abandon the MACRO _mycode style and just assign the partial case statement to a macro variable using a %LET and then referring to the macro variable instead of _mycode in the select clause.

Any thoughts or references from anybody about general management of percent signs in the macro context plus a specific solution most welcome.

TIA, Nigel

Nigel Greenwood EDS UK Systems Resource Management UK Mainframe Hosting Services Information Technology Outsourcing

External: 01253 335126 Internal: X65126

-----------------------------------------------------------------------

This document is strictly confidential and is intended only for use by the addressee. If you are not the intended recipient, any disclosure, copying, distribution or other action taken in reliance of the information contained in this e-mail is strictly prohibited. Any views expressed by the sender of this message are not necessarily those of the Department for Work and Pensions. If you have received this transmission in error, please use the reply function to tell us and then permanently delete what you have received. Please note: Incoming and outgoing e-mail messages are routinely monitored for compliance with our policy on the use of electronic communications.

The original of this email was scanned for viruses by the Government Secure Intranet (GSi) virus scanning service supplied exclusively by Energis in partnership with MessageLabs.

On leaving the GSi this email was certified virus-free __________________________________________________________________________________________________________________________________

This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately.

Ce courrier électronique est confidentiel et protégé. L'expéditeur ne renonce pas aux droits et obligations qui s'y rapportent. Toute diffusion, utilisation ou copie de ce message ou des renseignements qu'il contient par une personne autre que le (les) destinataire(s) désigné(s) est interdite. Si vous recevez ce courrier électronique par erreur, veuillez m'en aviser immédiatement, par retour de courrier électronique ou par un autre moyen.


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