<?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 Re: Error in CATT function? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Error-in-CATT-function/m-p/292542#M60739</link>
    <description>&lt;P&gt;The string being passed to Call Execute needs to be a valid SAS syntax. Currently it's not.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One way to debug this is to create a dataset and examine the values of STR being created.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data check;
Set idList;

Str = catt('%tool1(', id, Id2, ');');

*Call execute ( Str);
Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Open the check dataset and examine the values of STR. If they'renot valid &amp;nbsp;SAS code, what does it need.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-SPOILER&gt;You're missing the comma between the two parameters in the macro call. You can add it in the CATT function. It needs to resolve to %tool(id, id2);&lt;BR /&gt;&lt;BR /&gt;Right now it's resolving to the following which is incorrect.&lt;BR /&gt;&lt;BR /&gt;%tool(id id2);&lt;/LI-SPOILER&gt;</description>
    <pubDate>Thu, 18 Aug 2016 19:39:53 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-08-18T19:39:53Z</dc:date>
    <item>
      <title>Error in CATT function?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-in-CATT-function/m-p/292526#M60731</link>
      <description>&lt;P&gt;Hi again helpful SAS community!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A couple of weeks ago, Reeza was super helpful and helped me create run a macro by pulling ids from a large (10,000) file.&lt;/P&gt;&lt;P&gt;Here's what she suggested - which worked&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data _null_;
Set idlist2;

Str = catt('%tool(', id, ');');
Call execute ( Str);

Run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However, part of my Macro involved running an x-command, and although I was indeed generating multiple excel spreadsheets, the data within the docs generated were messed up ... I *think* because of timing issues.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In any case, what I need now is to parse TWO fields from the IdList dataset into my Macro ... here's what I'm trying (code below), but it doesn't work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data _null_;
Set idList;

Str = catt('%tool1(', id, Id2, ');');

Call execute ( Str);
Run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I think I'm missing something really basic about the "CATT" function that I just can't see. &amp;nbsp;I hope this is a really basic error - I don't mind looking dumb if I can learn something new! &amp;nbsp;I hope someone can help me figure this out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you so much!&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2016 18:47:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-in-CATT-function/m-p/292526#M60731</guid>
      <dc:creator>Geetu</dc:creator>
      <dc:date>2016-08-18T18:47:48Z</dc:date>
    </item>
    <item>
      <title>Re: Error in CATT function?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-in-CATT-function/m-p/292540#M60737</link>
      <description>&lt;P&gt;Perhaps try to put the contents of STR prior to the call execute. And why are you sure that this has to do with the catt function? You need to debug all steps, including the macro.&lt;/P&gt;
&lt;P&gt;A LOG would help...&lt;/P&gt;
&lt;P&gt;I can't see the macro definition here, but but you may want a comma between id and id2?&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2016 19:38:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-in-CATT-function/m-p/292540#M60737</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-08-18T19:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: Error in CATT function?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-in-CATT-function/m-p/292541#M60738</link>
      <description>&lt;P&gt;I'm guessing that you want a comma between your arguments? Maybe&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token function"&gt;Str&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;catt&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'%tool1('&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;id&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;, ',',&lt;/SPAN&gt; Id2&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;');'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2016 19:39:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-in-CATT-function/m-p/292541#M60738</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-08-18T19:39:19Z</dc:date>
    </item>
    <item>
      <title>Re: Error in CATT function?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-in-CATT-function/m-p/292542#M60739</link>
      <description>&lt;P&gt;The string being passed to Call Execute needs to be a valid SAS syntax. Currently it's not.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One way to debug this is to create a dataset and examine the values of STR being created.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data check;
Set idList;

Str = catt('%tool1(', id, Id2, ');');

*Call execute ( Str);
Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Open the check dataset and examine the values of STR. If they'renot valid &amp;nbsp;SAS code, what does it need.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-SPOILER&gt;You're missing the comma between the two parameters in the macro call. You can add it in the CATT function. It needs to resolve to %tool(id, id2);&lt;BR /&gt;&lt;BR /&gt;Right now it's resolving to the following which is incorrect.&lt;BR /&gt;&lt;BR /&gt;%tool(id id2);&lt;/LI-SPOILER&gt;</description>
      <pubDate>Thu, 18 Aug 2016 19:39:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-in-CATT-function/m-p/292542#M60739</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-08-18T19:39:53Z</dc:date>
    </item>
    <item>
      <title>Re: Error in CATT function?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-in-CATT-function/m-p/292545#M60741</link>
      <description>&lt;P&gt;Could provide at least an example of the input values and what the catt function is yielding?&lt;/P&gt;
&lt;P&gt;Since you have a variable from your data set that we have no idea about the value it is kind of hard to guess.&lt;/P&gt;
&lt;P&gt;if that ID variable contains punction such as , or % or &amp;amp; then lots of potential issues.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2016 19:50:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-in-CATT-function/m-p/292545#M60741</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-08-18T19:50:35Z</dc:date>
    </item>
    <item>
      <title>Re: Error in CATT function?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-in-CATT-function/m-p/292553#M60745</link>
      <description>&lt;P&gt;Thanks everyone. I did use SYMBOLGEN option so I could see how the macro was resolving.&lt;/P&gt;&lt;P&gt;Yeah, I agree, there's a comma missing ... however, when I tried to add one - here's the code &amp;amp; error message:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;952   Str = catt('%tool1(', id,"," Id2, ');');
                                   ---
                                   22
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, *, **, +, ',', -, /, &amp;lt;, &amp;lt;=,
              &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;&amp;lt;, &amp;gt;=, AND, EQ, GE, GT, IN, LE, LT, MAX, MIN, NE, NG, NL, NOTIN, OR, ^=,
              |, ||, ~=.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The reason I think I'm just not getting some nuance of CATT is that if I use the old method of concatenating (I'm a dinosaur):&lt;/P&gt;&lt;PRE&gt;Str2 = '%tool1(' || trim(id) || ',' || trim(IdN) || ');' ;&lt;/PRE&gt;&lt;P&gt;I get what I need. &amp;nbsp;I should be content LOL .. but it's bugging me that CATT won't work here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks all.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2016 20:16:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-in-CATT-function/m-p/292553#M60745</guid>
      <dc:creator>Geetu</dc:creator>
      <dc:date>2016-08-18T20:16:06Z</dc:date>
    </item>
    <item>
      <title>Re: Error in CATT function?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-in-CATT-function/m-p/292561#M60750</link>
      <description>&lt;P&gt;Hi Ballardw ... here's a sample of the IDlist .. nothing that should be a problem&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ID              ID2 
T1-OX3-3007     S3007 
T1-OX3-3010     S3010 
T1-OX3-3081     S3081 
T1-OX3-3083     S3083 
T1-OX3-3087     S3087 


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;thanks for helping&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2016 20:45:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-in-CATT-function/m-p/292561#M60750</guid>
      <dc:creator>Geetu</dc:creator>
      <dc:date>2016-08-18T20:45:22Z</dc:date>
    </item>
    <item>
      <title>Re: Error in CATT function?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-in-CATT-function/m-p/292564#M60752</link>
      <description>&lt;P&gt;Now you're missing a comma &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Put them each on their own line to help. Note the missing comma after the "," in your code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token function"&gt;Str&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;catt&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'%tool1('&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;BR /&gt;&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;id&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;","&lt;/SPAN&gt; &lt;BR /&gt;Id2&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN class="token string"&gt;');'&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
                                   &lt;SPAN class="token operator"&gt;-&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;-&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;-&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2016 20:53:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-in-CATT-function/m-p/292564#M60752</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-08-18T20:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: Error in CATT function?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-in-CATT-function/m-p/292567#M60755</link>
      <description>&lt;P&gt;Thanks Linus .. I did debug and test the Macro independently; my other responses here should help clarify why I think it's the CATT function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for helping ...and I love your tag line!&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2016 20:57:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-in-CATT-function/m-p/292567#M60755</guid>
      <dc:creator>Geetu</dc:creator>
      <dc:date>2016-08-18T20:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: Error in CATT function?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-in-CATT-function/m-p/292569#M60757</link>
      <description>&lt;P&gt;LOL!! &amp;nbsp;That's it!! &amp;nbsp;&amp;lt;DUH!&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sigh ... reminds me of when I first started using SAS 20 years ago and would forget a semi-colon!&lt;/P&gt;&lt;P&gt;I've been away from SAS for 2 years &amp;nbsp;... one gets rusty, but it's nice to know this dinosaur can still learn some new tricks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks again Reeza, and everyone else here to helped!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Love the SAS community!&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2016 21:00:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-in-CATT-function/m-p/292569#M60757</guid>
      <dc:creator>Geetu</dc:creator>
      <dc:date>2016-08-18T21:00:18Z</dc:date>
    </item>
  </channel>
</rss>

