Date: Fri, 9 Dec 2011 02:14:56 -0500
Reply-To: Tom Abernathy <tom.abernathy@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Tom Abernathy <tom.abernathy@GMAIL.COM>
Subject: Re: a macro checking invalid variable name
You first two data lines will result in the same value in the variable
VARNAME. If you want to preserve the leading spaces use the $CHAR informat.
On Thu, 8 Dec 2011 23:58:49 -0500, bbser 2009 <bbser2009@GMAIL.COM> wrote:
>The code below is suppose to check if a given literal can be used as a
>I would like to check the four literals one at a time in the data step.
>Only the first two are suppose to be valid.
>But after running the code, I only got one comment in the log about the
>long literal (39 characters long), which said the literal is valid,
>apparently contrary to the name criterion.
>What am I missing here? In addition, do you think I am using %bquote
>Please help. Thank you very much in advance!
>%if valid=0 %then
> %let position=%sysfunc(notname(&value));
> %put ***The first invalid character of %upcase(&value) is in position:;
> %put &position;
> %put ***%upcase(&value) is a valid variable name.;
>length varname $ 39;
>input varname $ 1-39;
>*the purpose of using %bquote is to preserve blanks at the beginning of