Date: Mon, 4 Sep 2006 15:36:01 -0400
Reply-To: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject: Re: How to remove leading blanks from macro variables
Content-Type: text/plain; charset=ISO-8859-1
On Sat, 2 Sep 2006 13:50:12 -0400, Joe Whitehurst <joewhitehurst@GMAIL.COM>
>Let me confute all the other respondents to your question by pointing
>out that this issue just cannot arise with the more modern SAS
>Component Language when creating symbolic variables for conditionally
>controlling the creation and execution of any SAS code whatsoever
>especially in batch processing environments. With SAS Component
>Language numeric values remain numeric values even when the variables
>containing them are used as symbolic variables.. There is never an
>issue caused by the implicit retyping of variables. SAS Component
>Language List elements are always left aligned without regard to their
>type. So go forth and learn about the more modern SAS Component
>Language and leave the Antiquated Macro Language for your inferiors
>to wallow in..
But, there is no use of the macro *language* in this scenario; no %MACRO.
There is use of macro *variables*, but that's not the same thing.
There's been a lot of debate (I'm being charitable) here recently over the
proposition that people should abandon the macro language. The idea does not
seem to be getting much traction.
Suggesting abandonment of macro variables altogether is a more extreme
position and I would say even less defensible.
In this particular situation the macro variables are loaded via the "host
variable" mechanism (INTO : ). PROC SQL supports this mechanism for macro
variables but not, as far as I can see, for SCL (and that may say something
about SAS Institute's perceptions of the centrality of SCL). So what would
be the mechanism for feeding SQL results to SCL? Probably more roundabout
than what Rune is doing here.
>On 9/1/06, Rune RunnestÝ <firstname.lastname@example.org> wrote:
>> How do I remove leading blanks from macro variable values ?
>> Here is a snippet of code demonstrating the issue:
>> proc sql noprint;
>> select count(*) into :num_sd_dok_bads_may_be_OK_1
>> from &lib..tp33_sd_dok_badrecs_may_be_OK_1;
>> select count(*) into :num_sd_dok_bads_not_OK_1
>> from &lib..tp33_sd_dok_badrecs_not_OK_1;
>> %put &num_sd_dok_bads_may_be_OK_1;
>> %put &num_sd_dok_bads_not_OK_1;
>> >From the log:
>> SYMBOLGEN: Macro variable NUM_SD_DOK_BADS_MAY_BE_OK_1 resolves to
>> SYMBOLGEN: Macro variable NUM_SD_DOK_BADS_NOT_OK_1 resolves to
>> As we see, the macro variables have leading blanks. This is
>> when using them in text strings. How do I get rid of leading blanks in
>> macro variables ?
>To paraphrase G. Santayana, the SAS Macro Facility used by common SAS
>programmers is an old mate that gives no pleasure and many headaches,
>yet she/he cannot live without it, and resents any aspersions that
>strangers may cast on its character