Date: Tue, 28 Oct 1997 11:16:32 -0500
Reply-To: WHITLOI1 <whitloi1@WESTAT.COM>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: WHITLOI1 <whitloi1@WESTAT.COM>
Subject: Re: Inconsistency in SAS data step
Subject: Inconsistency in SAS data step
Summary: It is not so strange when you consider the exceptions.
Respondent: Ian Whitlock <whitloi1@westat.com>
Patrick Druijts <druytsp@OIOV59.MRGATE.VESTA.UMC.AKZONOBEL.NL> pointed
out that
>data _null_;
>
>y1=0;
>put "Y1="y1;
>
>t1=0;
>put "T1="t1; *** NO space between character string and name of variable;
>run;
yields a compile time error for the second PUT statement. For any
letter, macro variable L, Patrick could have written
put "&L.1="&L.1 ;
and have the statement compile correctly with certain exceptions. The
exceptions are B, D, T, and X. Why? I suspect because
"___"B, "___"D, "___"T, and "___"X
have special meanings. Now these meanings are not legal in a PUT
statement, but they still affect the way the PUT statement is compiled.
Probably because the word scanner breaks the string up into tokens for
the compiler and the word scanner knows nothing about PUT statements,
but it does know how to look for special letters immediately following
a quoted string. The error messages vary and are a bit (pun intended)
misleading with the exceptions of B and X.
In this case I suggest it was Patrick's mistake for not clearly adding
separators for his character strings or for not using the simpler
put t1=t1 ;
and avoiding the issue.
Ian Whitlock <whitloi1@westat.com>