home *** CD-ROM | disk | FTP | other *** search
- Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
- Path: sparky!uunet!paladin.american.edu!auvm!BINGVMB.BITNET!LJONES
- Message-ID: <SAS-L%92081308561549@UGA.CC.UGA.EDU>
- Newsgroups: bit.listserv.sas-l
- Date: Thu, 13 Aug 1992 08:29:48 ECT
- Reply-To: Lary Jones <LJONES@BINGVMB.BITNET>
- Sender: "SAS(r) Discussion" <SAS-L@UGA.BITNET>
- From: Lary Jones <LJONES@BINGVMB.BITNET>
- Subject: Re: Macro variable naming conventions
- In-Reply-To: Message of Wed, 12 Aug 1992 13:40:13 EDT from <HIS@NIHCU>
- Lines: 45
-
- On Wed, 12 Aug 1992 13:40:13 EDT Howard Schreier said:
- >CONTENT: Suggestion
- >SUMMARY: Care needed for "regular" names within macros
- >
- . . . stuff deleted . . .
- >
- >Sometimes it is necessary for a macro to create new
- >variables or data sets on a temporary basis (the variables
- >get DROPped; the data sets are in the WORK library).
- >Obviously, it is important to avoid conflicts with existing
- >objects. The convention I have sometimes used is to begin
- >these names with a *double* underscore. For example:
- >
- > %macro whatever . . .
- >
- > *;
- > data __temp1;
- > *;
- > . . .
- >
-
- Thanks for bringing this up, Howard, and funny you should mention it.
- The example I have prepared for "coder's corner" at NESUG in October
- includes similar conventions.
-
- a. Every SAS variable created in the macro is declared via a LENGTH or
- ATTRIBUTE statement immediately following the %MACRO statement, and
-
- b. DROPped at the end of a macro, just prior to the %MEND;
-
- c. Since some variables are passed on, all work variables (skipping
- loop indeces, etc.) are named II_xxxxx, where II is a two character
- abbreviation for the macro, and xxxxx is the distinctive name.
-
- Example: The macro ParsDat, which parses arbitrary date strings
- into a year, month, and day, returns the variables PD_Year,
- PD_Mon, and PD_Day.
-
- These conventions are used to insure, and localize, control of variables.
- I do not claim that my conventions are "best," or even that they will
- suit other's needs. Simply, they work for me :-)
-
- __________________________________________________________________
- Lary Jones...Computing Services...Binghamton Univ...(607) 777-2879
- School of Management Research Support ...... LJones@BingVMB.Bitnet
-