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 (June 2003, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 19 Jun 2003 11:28:06 -0400
Reply-To:     Ian Whitlock <WHITLOI1@WESTAT.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Ian Whitlock <WHITLOI1@WESTAT.COM>
Subject:      Re: Ending Macro Vars with dot (was: how to shorten the typing in
              SQL )
Comments: To: "Balint, Jess" <JBalint@ALLDATA.NET>
Content-Type: text/plain

Jess asked for advantages and disadvantages about using the dot at the end of all macro variable references.

The two outstanding disadvantages are:

1) A lot of unnecessary dots cluttering up the macro code (Similar to the problem, but not quite as bad, created by people who insist on using explicit parentheses in all possible places in arithmetic expressions) 2) Loss of reader and programmer awareness of when a dot is necessary

The main advantage is that, when you develop the habit, you will not be likely to forget a single crucial dot. However, one may be less sensitive to issues where multiple dots are required.

For me a second problem is consistency. I doubt if many people "always" ending a reference with a dot would recommend

&&X&i..

or

&&&var..

and yet that is what a consistent rule - end all references with a dot would require.

IanWhitlock@westat.com

-----Original Message----- From: Balint, Jess [mailto:JBalint@ALLDATA.NET] Sent: Thursday, June 19, 2003 10:45 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Ending Macro Vars with dot (was: how to shorten the typing in SQL )

Regarding the following code from the previous post: > &VAR.='412' > or '410'<=&VAR.<='41099' > or '428'<=&VAR.<='4289 ' > or &VAR. IN ('4293','40201','40211','40291')

Why do you end the macro var with "."? The was I understand it is as follows:

If you are appending something after the macro var value, then use dot, otherwise not. This would be similar to using ${I} in UNIX shell instead of $I.

Example 1: In this case, there is something to append to it, creating the need for ".".

data my_data_&VAR._file; some statements....;

Example 2: In this case, there is a clear termination to the macro var, eliminating the need for ".".

data my_data_file_&VAR; more statements....;

Is this the case? Are there a advantages/disadvantages to doing it either way? Thanks.

--jess


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