<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Using macro variables to retreive data from Javascript page in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Using-macro-variables-to-retreive-data-from-Javascript-page/m-p/12710#M1401</link>
    <description>Hello,&lt;BR /&gt;
I am reworking SAS code written by a previous programmer. I am having so much trouble trying to understand his/her logic in this macro call. A bunch of user defined macros check the parameters passed by a javascript page.&lt;BR /&gt;
&lt;BR /&gt;
The macro variables do not have any suffixes but there is a additional 0 while resolving. Any ideas why one would use it. &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
%macro stringGen(parm=);&lt;BR /&gt;
%if %symexist(&amp;amp;parm.0) %then %do;&lt;BR /&gt;
   %do i = 1 %to &amp;amp;&amp;amp;&amp;amp;parm.0;&lt;BR /&gt;
       %if &amp;amp;i = 1 %then &lt;BR /&gt;
		%do;&lt;BR /&gt;
		  %str("&amp;amp;&amp;amp;&amp;amp;parm&amp;amp;i")&lt;BR /&gt;
           %end;&lt;BR /&gt;
            %else %do;&lt;BR /&gt;
                %str(, "&amp;amp;&amp;amp;&amp;amp;parm&amp;amp;i")&lt;BR /&gt;
                %end;&lt;BR /&gt;
       %end;&lt;BR /&gt;
       %end;&lt;BR /&gt;
        %else %do;&lt;BR /&gt;
    %str("&amp;amp;&amp;amp;&amp;amp;parm")&lt;BR /&gt;
%end; &lt;BR /&gt;
%mend;&lt;BR /&gt;
&lt;BR /&gt;
Thanks,</description>
    <pubDate>Fri, 18 Feb 2011 02:13:01 GMT</pubDate>
    <dc:creator>saspert</dc:creator>
    <dc:date>2011-02-18T02:13:01Z</dc:date>
    <item>
      <title>Using macro variables to retreive data from Javascript page</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-macro-variables-to-retreive-data-from-Javascript-page/m-p/12710#M1401</link>
      <description>Hello,&lt;BR /&gt;
I am reworking SAS code written by a previous programmer. I am having so much trouble trying to understand his/her logic in this macro call. A bunch of user defined macros check the parameters passed by a javascript page.&lt;BR /&gt;
&lt;BR /&gt;
The macro variables do not have any suffixes but there is a additional 0 while resolving. Any ideas why one would use it. &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
%macro stringGen(parm=);&lt;BR /&gt;
%if %symexist(&amp;amp;parm.0) %then %do;&lt;BR /&gt;
   %do i = 1 %to &amp;amp;&amp;amp;&amp;amp;parm.0;&lt;BR /&gt;
       %if &amp;amp;i = 1 %then &lt;BR /&gt;
		%do;&lt;BR /&gt;
		  %str("&amp;amp;&amp;amp;&amp;amp;parm&amp;amp;i")&lt;BR /&gt;
           %end;&lt;BR /&gt;
            %else %do;&lt;BR /&gt;
                %str(, "&amp;amp;&amp;amp;&amp;amp;parm&amp;amp;i")&lt;BR /&gt;
                %end;&lt;BR /&gt;
       %end;&lt;BR /&gt;
       %end;&lt;BR /&gt;
        %else %do;&lt;BR /&gt;
    %str("&amp;amp;&amp;amp;&amp;amp;parm")&lt;BR /&gt;
%end; &lt;BR /&gt;
%mend;&lt;BR /&gt;
&lt;BR /&gt;
Thanks,</description>
      <pubDate>Fri, 18 Feb 2011 02:13:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-macro-variables-to-retreive-data-from-Javascript-page/m-p/12710#M1401</guid>
      <dc:creator>saspert</dc:creator>
      <dc:date>2011-02-18T02:13:01Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro variables to retreive data from Javascript page</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-macro-variables-to-retreive-data-from-Javascript-page/m-p/12711#M1402</link>
      <description>Hi:&lt;BR /&gt;
  This almost looks like the kind of macro %DO loop code that was used if you were receiving multiple parameter values from a SAS/IntrNet Application Dispatcher program or multiple parameter selection from a SAS Stored Process. &lt;BR /&gt;
&lt;BR /&gt;
For example, let's say you had a parameter or prompt for COUNTRY and the user was allowed to make up to 3 selections.&lt;BR /&gt;
 &lt;BR /&gt;
  Your "front end" prompting screen would only have COUNTRY, but after the users made their multiple selections, what your program would receive would be multiple macro variables with values like this (assuming the user made 3 choices):&lt;BR /&gt;
&amp;amp;COUNTRY0 = 3&lt;BR /&gt;
&amp;amp;COUNTRY1 = DENMARK&lt;BR /&gt;
&amp;amp;COUNTRY2 = BELGIUM&lt;BR /&gt;
&amp;amp;COUNTRY3 = CANADA&lt;BR /&gt;
 &lt;BR /&gt;
So for this parameter, &amp;amp;COUNTRY0 holds the number of user selections. A macro %DO loop was used with the value of &amp;amp;COUNTRY0 as the ending point for the %DO loop.&lt;BR /&gt;
 &lt;BR /&gt;
Your macro program seems to be doing something similar by iterating a macro %DO loop from 1 to &amp;amp;&amp;amp;&amp;amp;parm.0 -- which implies, to me, that some macro variable like &amp;amp;COUNTRY0 is being used. If, for example, the value of PARM was COUNTRY, then &amp;amp;&amp;amp;&amp;amp;parm.0 would resolve to &amp;amp;COUNTRY0 --&amp;gt; which would resolve to 3 -- so the %DO loop would iterate 3 times.&lt;BR /&gt;
 &lt;BR /&gt;
If this is related to a stored process, you might want to post this question in the stored process forum. If this is related to a SAS/IntrNet program or custom front end (part of the BI Platform), you might want to work with Tech Support.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Fri, 18 Feb 2011 02:33:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-macro-variables-to-retreive-data-from-Javascript-page/m-p/12711#M1402</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2011-02-18T02:33:09Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro variables to retreive data from Javascript page</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-macro-variables-to-retreive-data-from-Javascript-page/m-p/12712#M1403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This macro assumes a so-called &lt;EM&gt;macro variable array&lt;/EM&gt;. I am not a big fan, but sometimes you have no choice.I would have written the macro a bit differently, but the concept remains the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 9pt;"&gt;*-- returns a macro-quoted comma-separated double-quoted text,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; given an mac var array root1 - rootn, where root0 evaluates to n.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if root0 does not exists then root should exists as this macro&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; returns its value enquoted --*;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: #000080; font-size: 9pt; font-family: Courier New;"&gt;%macro&lt;/STRONG&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; qCsqv(root=);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%if&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; not &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%symexist&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;(&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-family: Courier New; font-size: 9pt;"&gt;root.0&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%then&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%do&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 9pt;"&gt;*;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%qsysfunc&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;(quote(&amp;amp;&amp;amp;&amp;amp;root))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%return&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%end&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%local&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; i;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%do&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; i = &lt;/SPAN&gt;&lt;STRONG style="color: #008080; font-size: 9pt; font-family: Courier New;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%to&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; &amp;amp;&amp;amp;&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-family: Courier New; font-size: 9pt;"&gt;root.0&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%if&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; &amp;amp;i &amp;gt; &lt;/SPAN&gt;&lt;STRONG style="color: #008080; font-size: 9pt; font-family: Courier New;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%then&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; %&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 9pt;"&gt;*;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%str&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;(, );&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 9pt;"&gt;*;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%qsysfunc&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;(quote(&amp;amp;&amp;amp;&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-family: Courier New; font-size: 9pt;"&gt;root.&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;amp;i))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%end&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: #000080; font-size: 9pt; font-family: Courier New;"&gt;%mend&lt;/STRONG&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp; qCsqv;&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 9pt;"&gt;*-- test1. when p0 exists --*;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; p0 = 3;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; p1 = a;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; p2 = b;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; p3 = c;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%put&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; %qCsqv(root=p);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 9pt;"&gt;*-- on log&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; "a", "b", "c"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; --*;&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 9pt;"&gt;*-- test2. when p0 does not exist --*;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%symdel&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; p0 p1 p2 p3;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; p = hello;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%put&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; %qCsqv(root=p);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 9pt;"&gt;*-- on log&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; "hello"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; --*;&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Feb 2011 15:50:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-macro-variables-to-retreive-data-from-Javascript-page/m-p/12712#M1403</guid>
      <dc:creator>chang_y_chung_hotmail_com</dc:creator>
      <dc:date>2011-02-18T15:50:36Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro variables to retreive data from Javascript page</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-macro-variables-to-retreive-data-from-Javascript-page/m-p/12713#M1404</link>
      <description>Thank you Cynthia for your diagnosis. &lt;BR /&gt;
Also, thank you Chang for your alternative method. I think your method worked better. &lt;BR /&gt;
&lt;BR /&gt;
 The macro call that I posted gave this in the log&lt;BR /&gt;
MLOGIC(TEST):  %PUT &amp;amp;old&lt;BR /&gt;
SYMBOLGEN:  Macro variable OLD resolves to "BOEING CORPORATION                                          "&lt;BR /&gt;
SYMBOLGEN:  Some characters in the above value which were subject to macro quoting have been unquoted for printing.&lt;BR /&gt;
"BOEING CORPORATION                                          "&lt;BR /&gt;
&lt;BR /&gt;
and Chang's code gave this in the log &lt;BR /&gt;
MLOGIC(TEST):  %PUT &amp;amp;new&lt;BR /&gt;
SYMBOLGEN:  Macro variable NEW resolves to "BOEING CORPORATION"&lt;BR /&gt;
SYMBOLGEN:  Some characters in the above value which were subject to macro quoting have been unquoted for printing.&lt;BR /&gt;
"BOEING CORPORATION"&lt;BR /&gt;
&lt;BR /&gt;
But, I still have a few questions. &lt;BR /&gt;
1. I am thinking %str("&amp;amp;&amp;amp;&amp;amp;parm") resulted in the extra spaces. Do you know why?&lt;BR /&gt;
I tried this to remove any extra spaces but it did not make a difference.&lt;BR /&gt;
PROC SQL;&lt;BR /&gt;
 SELECT  DISTINCT trim((DC.PRCHSR_NM)) AS PNAME&lt;BR /&gt;
    into :PNAME &lt;BR /&gt;
 FROM EHP.DC AS DC &lt;BR /&gt;
	 WHERE DC.PRCHSR_CD = "BOI"&lt;BR /&gt;
		  order by 1;&lt;BR /&gt;
QUIT;&lt;BR /&gt;
&lt;BR /&gt;
2. I am getting different results while running the same code in different places. Sometimes it returns "&amp;amp;PNAME in an EG session. When I run it in a stored process, it gives a blank output. Is this a question for Tech Support?</description>
      <pubDate>Fri, 18 Feb 2011 20:59:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-macro-variables-to-retreive-data-from-Javascript-page/m-p/12713#M1404</guid>
      <dc:creator>saspert</dc:creator>
      <dc:date>2011-02-18T20:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro variables to retreive data from Javascript page</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-macro-variables-to-retreive-data-from-Javascript-page/m-p/12714#M1405</link>
      <description>Hi:&lt;BR /&gt;
  About #1:&lt;BR /&gt;
Let's just ignore everything about the macro program you started with and go back to basics of how macro variables are created and look at what happens in the SQL step. Here's some sample code (shown in the SAS log):&lt;BR /&gt;
[pre]&lt;BR /&gt;
919  proc sql noprint;&lt;BR /&gt;
920    SELECT DISTINCT trim(name) AS PNAME&lt;BR /&gt;
921      into :PNAME&lt;BR /&gt;
922      FROM sashelp.class AS DC&lt;BR /&gt;
923      WHERE dc.name = "John";&lt;BR /&gt;
924  QUIT;&lt;BR /&gt;
NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;
      real time           0.00 seconds&lt;BR /&gt;
      cpu time            0.00 seconds&lt;BR /&gt;
                         &lt;BR /&gt;
                              &lt;BR /&gt;
925&lt;BR /&gt;
926  ** show trailing spaces for PNAME;&lt;BR /&gt;
927  %put PNAME |&amp;amp;pname|;&lt;BR /&gt;
PNAME |John    |&lt;BR /&gt;
928&lt;BR /&gt;
929  ** %LET will remove trailing spaces;&lt;BR /&gt;
930  %let pname=&amp;amp;pname;&lt;BR /&gt;
931&lt;BR /&gt;
932  ** show trailing spaces gone;&lt;BR /&gt;
933  %put PNAME  |&amp;amp;pname|;&lt;BR /&gt;
PNAME  |John|&lt;BR /&gt;
[/pre]&lt;BR /&gt;
                     &lt;BR /&gt;
 The internally stored value for NAME ($8) is what gets written to the macro variable &amp;amp;PNAME. So even if TRIM briefly trims trailing blanks in memory during the SQL step, it is the internal value that is used. The first %PUT shows a | symbol on either side of the resolved value for &amp;amp;PNAME. The behavior is explained further in this Tech Support note:&lt;BR /&gt;
&lt;A href="http://support.sas.com/kb/2/748.html" target="_blank"&gt;http://support.sas.com/kb/2/748.html&lt;/A&gt;&lt;BR /&gt;
 &lt;BR /&gt;
  A simple %LET will remove trailing spaces. (as explained in the note and shown in the above example).&lt;BR /&gt;
&lt;BR /&gt;
  An alternative to PROC SQL's INTO (for simple examples like your example) is to use DATA _NULL_ and CALL SYMPUT.&lt;BR /&gt;
[pre]&lt;BR /&gt;
942  data _null_;&lt;BR /&gt;
943    set sashelp.class;&lt;BR /&gt;
944    where name = "John";&lt;BR /&gt;
945    call symput("DNAME",compress(name));&lt;BR /&gt;
946  run;&lt;BR /&gt;
                     &lt;BR /&gt;
NOTE: There were 1 observations read from the data set SASHELP.CLASS.&lt;BR /&gt;
      WHERE name='John';&lt;BR /&gt;
NOTE: DATA statement used (Total process time):&lt;BR /&gt;
      real time           0.03 seconds&lt;BR /&gt;
      cpu time            0.01 seconds&lt;BR /&gt;
                &lt;BR /&gt;
                         &lt;BR /&gt;
947  %put DNAME |&amp;amp;dname|;&lt;BR /&gt;
DNAME |John|&lt;BR /&gt;
[/pre]&lt;BR /&gt;
                               &lt;BR /&gt;
If you prefer the SQL approach, then a simple %LET will take care of trailing spaces. &lt;BR /&gt;
  &lt;BR /&gt;
#2: You say you are getting different results when running your code in different places. If this is a stored process and you are getting different results with the same stored process in different client applications, then you should work with Tech Support on this issue. &lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Sat, 19 Feb 2011 15:58:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-macro-variables-to-retreive-data-from-Javascript-page/m-p/12714#M1405</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2011-02-19T15:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro variables to retreive data from Javascript page</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-macro-variables-to-retreive-data-from-Javascript-page/m-p/12715#M1406</link>
      <description>Thank you Cynthia for the tip on how macro variables store data.&lt;BR /&gt;
I think I have to contact Tech Support on this.&lt;BR /&gt;
&lt;BR /&gt;
Regards,</description>
      <pubDate>Sat, 19 Feb 2011 22:39:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-macro-variables-to-retreive-data-from-Javascript-page/m-p/12715#M1406</guid>
      <dc:creator>saspert</dc:creator>
      <dc:date>2011-02-19T22:39:45Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro variables to retreive data from Javascript page</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-macro-variables-to-retreive-data-from-Javascript-page/m-p/12716#M1407</link>
      <description>Hello,&lt;BR /&gt;
&lt;BR /&gt;
&lt;P&gt;Cynthia, I figured out that adding&lt;I&gt;separated by ' '&lt;/I&gt; in proc sql also removes trailing blanks. of course, it makes not sense when you are selecting only one record but for removing trailing blanks.&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
Marius</description>
      <pubDate>Sun, 20 Feb 2011 16:48:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-macro-variables-to-retreive-data-from-Javascript-page/m-p/12716#M1407</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2011-02-20T16:48:41Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro variables to retreive data from Javascript page</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-macro-variables-to-retreive-data-from-Javascript-page/m-p/12717#M1408</link>
      <description>Hi.&lt;BR /&gt;
In proc sql ,selecting only one record  (i.e. single macro variable) ,that macro variable will keep the trailing blanks.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Thu, 24 Feb 2011 08:15:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-macro-variables-to-retreive-data-from-Javascript-page/m-p/12717#M1408</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-02-24T08:15:39Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro variables to retreive data from Javascript page</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-macro-variables-to-retreive-data-from-Javascript-page/m-p/12718#M1409</link>
      <description>Hi.&lt;BR /&gt;
In proc sql ,selecting only one record  (i.e. single macro variable) ,that macro variable will keep the trailing blanks.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Thu, 24 Feb 2011 08:19:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-macro-variables-to-retreive-data-from-Javascript-page/m-p/12718#M1409</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-02-24T08:19:15Z</dc:date>
    </item>
  </channel>
</rss>

