<?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 Syntax ERROR while passing macro value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Syntax-ERROR-while-passing-macro-value/m-p/787675#M251720</link>
    <description>&lt;P&gt;below is the simple dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;input:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="abhinayingole_1-1640804002678.png" style="width: 316px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66991i98DE9A79EB5A5F39/image-dimensions/316x94?v=v2" width="316" height="94" role="button" title="abhinayingole_1-1640804002678.png" alt="abhinayingole_1-1640804002678.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output expected:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="abhinayingole_0-1640807302762.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66995i8ABCE0CFDFB1884B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="abhinayingole_0-1640807302762.png" alt="abhinayingole_0-1640807302762.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am facing syntax error (screen shot at last) while executing below code .&lt;/P&gt;&lt;P&gt;could someone please help ?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;data x;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;length val $50;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;val = "m1 = strip(put(count,best.)) ;"; count =1; output;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;val = "m7 = strip(put(count,10.2))|| '/';"; count =2; output;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;proc sql noprint;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;select distinct val into: stat separated by " " from x&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;%let stat = %nrbquote(&amp;amp;stat.);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;quit;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;%put R E S = &amp;amp;stat.;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;data x2;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;&amp;nbsp;set x;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;&amp;nbsp;&amp;amp;stat.;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="abhinayingole_2-1640804148509.png" style="width: 718px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66992i1AE2C100D7109474/image-dimensions/718x286?v=v2" width="718" height="286" role="button" title="abhinayingole_2-1640804148509.png" alt="abhinayingole_2-1640804148509.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 29 Dec 2021 19:48:58 GMT</pubDate>
    <dc:creator>abhinayingole</dc:creator>
    <dc:date>2021-12-29T19:48:58Z</dc:date>
    <item>
      <title>Syntax ERROR while passing macro value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-ERROR-while-passing-macro-value/m-p/787675#M251720</link>
      <description>&lt;P&gt;below is the simple dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;input:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="abhinayingole_1-1640804002678.png" style="width: 316px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66991i98DE9A79EB5A5F39/image-dimensions/316x94?v=v2" width="316" height="94" role="button" title="abhinayingole_1-1640804002678.png" alt="abhinayingole_1-1640804002678.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output expected:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="abhinayingole_0-1640807302762.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66995i8ABCE0CFDFB1884B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="abhinayingole_0-1640807302762.png" alt="abhinayingole_0-1640807302762.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am facing syntax error (screen shot at last) while executing below code .&lt;/P&gt;&lt;P&gt;could someone please help ?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;data x;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;length val $50;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;val = "m1 = strip(put(count,best.)) ;"; count =1; output;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;val = "m7 = strip(put(count,10.2))|| '/';"; count =2; output;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;proc sql noprint;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;select distinct val into: stat separated by " " from x&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;%let stat = %nrbquote(&amp;amp;stat.);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;quit;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;%put R E S = &amp;amp;stat.;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;data x2;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;&amp;nbsp;set x;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;&amp;nbsp;&amp;amp;stat.;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="abhinayingole_2-1640804148509.png" style="width: 718px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66992i1AE2C100D7109474/image-dimensions/718x286?v=v2" width="718" height="286" role="button" title="abhinayingole_2-1640804148509.png" alt="abhinayingole_2-1640804148509.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Dec 2021 19:48:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-ERROR-while-passing-macro-value/m-p/787675#M251720</guid>
      <dc:creator>abhinayingole</dc:creator>
      <dc:date>2021-12-29T19:48:58Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax ERROR while passing macro value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-ERROR-while-passing-macro-value/m-p/787687#M251729</link>
      <description>&lt;P&gt;Can you show the SAS code you are trying to use the macro processor to create?&lt;/P&gt;
&lt;P&gt;Is it something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data x2;
  set x;
  m1 = strip(put(count,best.)) ; 
  m7 = strip(put(count,10.2))|| '/';
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If so then it is just your attempts to mess with the macro variable that is causing the errors.&lt;/P&gt;
&lt;P&gt;To see what the PROC SQL code has created use %superq() macro function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;621   %put %superq(stat);
m1 = strip(put(count,best.)) ; m7 = strip(put(count,10.2))|| '/';
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;How many observations will X have?&amp;nbsp; Will the generated macro variable get to be longer than 64K bytes?&lt;/P&gt;
&lt;P&gt;It might be easier to just write the code to a file instead.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename code temp;
data _null_;
  set x;
  file code;
  put val;
run;
data x2;
  set x;
%include code / source2;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Plus the SAS log will be easier to read.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Dec 2021 20:45:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-ERROR-while-passing-macro-value/m-p/787687#M251729</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-12-29T20:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax ERROR while passing macro value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-ERROR-while-passing-macro-value/m-p/787688#M251730</link>
      <description>&lt;P&gt;Not sure what's going on with the statement causing the error but try removing the "space". It might be a tab or some other unprintable character. Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;val = "m7 = strip(put(count,10.2))!!'/';";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I also suspect there are better ways to do what you want, but since you haven't explained what that is, I'll leave it at that.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Dec 2021 20:46:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-ERROR-while-passing-macro-value/m-p/787688#M251730</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-12-29T20:46:20Z</dc:date>
    </item>
  </channel>
</rss>

