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 (April 2002, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 29 Apr 2002 13:07:57 -0400
Reply-To:     bramley.m@PG.COM
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         bramley.m@PG.COM
Subject:      Re: poll: user-defined readonly macro variable
Content-type: text/plain; charset=us-ascii

SAS-L:

Many languages implement "constants" (eg:C++). Why not %Const construct that allows you to _define_ and _initialize_ a macro variable? This can be thought of as a superior form of "%Let".

eg: %Const MyMacroVar = SomeConstantValue ;

Why stop at macro? why not include a "const" statement in the DATASTEP, etc. with the compiler kicking out a error if you (or a later programmer) tried to modify that value in the datastep ?

Data NewData ; ... Const TestValue "ConstantTestValue" ; Const NumValue 2*3.14159 ; ... Run ;

Hmm, could that open the door to introducing function values in Const/Retain statements, eg: Retain Const SASFunction(par1,...) ? That would be nice...imho.

Sincerely,

Michael Bramley Cha Gheill!

Internet Mail Message Received from host: malibu.cc.uga.edu [128.192.1.103]

From: Paul Thompson <paul@WUBIOS.WUSTL.EDU> on 04/29/2002 04:46 PM GMT

Paul Thompson To: SAS-L@LISTSERV.UGA.EDU <paul@WUBIOS.WUSTL.EDU> Cc: (bcc: Michael Bramley-M/PGI) Subject: Re: poll: user-defined readonly macro variable 04/29/2002 12:46 PM Please respond to Paul Thompson <paul@WUBIOS.WUSTL.EDU>

Fehd, Ronald J. wrote:

>From: Shoemaker, Jack [mailto:shoe@statprobetechnologies.com] > >>How about another macro declaration >>to complement %global and %local, >>say, %readonly? So, a macro my look like this: >>%macro sample(); >>%global A_GLOBAL_VALUE; >>%local A_LOCAL_COUNTER; >>%readonly A_SPECIAL_TYPE_OF_GLOBAL; >>%mend sample; >> > >yes! that's a good idea! > >That options stuff always gets so complicated >what with The Options Naming Committee and their Agenda. > >- - - - autoexec - - - - >%LET A_SPECIAL_TYPE_OF_GLOBAL = some value; >%readonly A_SPECIAL_TYPE_OF_GLOBAL; >- - - autoexec end - - - - > >Ron Fehd the macro maven CDC Atlanta GA USA RJF2@cdc.gov > I like the idea. I use %global variables extensively. However, what would be the rule to allow the value to be modified? Would you need to set it once, and, once the %readonly condition was applied, it could not be modified again?

The basic idea is very appealing.


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