home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / bit / listserv / sasl / 3702 < prev    next >
Encoding:
Text File  |  1992-08-13  |  2.2 KB  |  58 lines

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