<?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: array / string in macro variable in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/array-string-in-macro-variable/m-p/63508#M18059</link>
    <description>Explain exactly how you expect to use the data - what type of SAS code, DATA step, PROC SQL, MACRO usage?  Also, provide a SAS-generated log where you are using the string with your %LET revealed and all other code, embedded in a SAS program - use COPY / PASTE for your  log to add to a forum post-reply.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
    <pubDate>Tue, 18 Jan 2011 17:39:21 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2011-01-18T17:39:21Z</dc:date>
    <item>
      <title>array / string in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/array-string-in-macro-variable/m-p/63507#M18058</link>
      <description>Hello,&lt;BR /&gt;
&lt;BR /&gt;
this assingment works in sas.&lt;BR /&gt;
%let arr = 'aaa', 'bbb', 'ccc';&lt;BR /&gt;
&lt;BR /&gt;
The "arr" variable contains the array of 3 strings? Or it contains only one long string?&lt;BR /&gt;
&lt;BR /&gt;
Because when i pass the "arr" variable to %substr function, it fail because the variable contains comma, which is also separator in function arguments.&lt;BR /&gt;
&lt;BR /&gt;
My question is&lt;BR /&gt;
- in case if arr variable is array of strings, how can I reference particular items?&lt;BR /&gt;
- in case it is only one string, how can i handle special character (comma) in the string?&lt;BR /&gt;
&lt;BR /&gt;
Thanks for an answer</description>
      <pubDate>Tue, 18 Jan 2011 17:15:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/array-string-in-macro-variable/m-p/63507#M18058</guid>
      <dc:creator>Julo</dc:creator>
      <dc:date>2011-01-18T17:15:58Z</dc:date>
    </item>
    <item>
      <title>Re: array / string in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/array-string-in-macro-variable/m-p/63508#M18059</link>
      <description>Explain exactly how you expect to use the data - what type of SAS code, DATA step, PROC SQL, MACRO usage?  Also, provide a SAS-generated log where you are using the string with your %LET revealed and all other code, embedded in a SAS program - use COPY / PASTE for your  log to add to a forum post-reply.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Tue, 18 Jan 2011 17:39:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/array-string-in-macro-variable/m-p/63508#M18059</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2011-01-18T17:39:21Z</dc:date>
    </item>
    <item>
      <title>Re: array / string in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/array-string-in-macro-variable/m-p/63509#M18060</link>
      <description>Your ARR contains a single string.&lt;BR /&gt;
&lt;BR /&gt;
Before dealing with options on handling, it does help to how the how thing is used. For most purposes in a macro both the quotes around your values and the commas are likely to be unneeded.</description>
      <pubDate>Tue, 18 Jan 2011 18:25:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/array-string-in-macro-variable/m-p/63509#M18060</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2011-01-18T18:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: array / string in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/array-string-in-macro-variable/m-p/63510#M18061</link>
      <description>Though data-strings can be addressed in various methods using SAS, I have to say that sometimes the specific intent is to provide the quoted-string and use it somehow where such a data-value is supplied, such as using a WHERE statement with an "IN" operator.&lt;BR /&gt;
&lt;BR /&gt;
On occasion, a "flower boxed" %LET statement is used to reveal a "prompt like" interaction from an end-user who has been given a self-contained SAS program, where the only interaction is to "fill in the desired filter values, in quote-marks".&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Tue, 18 Jan 2011 18:35:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/array-string-in-macro-variable/m-p/63510#M18061</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2011-01-18T18:35:34Z</dc:date>
    </item>
    <item>
      <title>Re: array / string in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/array-string-in-macro-variable/m-p/63511#M18062</link>
      <description>...&lt;BR /&gt;&lt;BR /&gt;
&amp;gt; this assingment works in sas.&lt;BR /&gt;&lt;BR /&gt;
&amp;gt; %let arr = 'aaa', 'bbb', 'ccc';&lt;BR /&gt;&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;&lt;BR /&gt;
&amp;gt; The "arr" variable contains the array of 3 strings?&lt;BR /&gt;&lt;BR /&gt;
&amp;gt; Or it contains only one long string?&lt;BR /&gt;&lt;BR /&gt;
&lt;BR /&gt;&lt;BR /&gt;
It is a value that is assigned to a macro variable. Macro variables store text, or a string of characters.&lt;BR /&gt;&lt;BR /&gt;
&lt;BR /&gt;&lt;BR /&gt;
&amp;gt; Because when i pass the "arr" variable to %substr&lt;BR /&gt;&lt;BR /&gt;
&amp;gt; function, it fail because the variable contains&lt;BR /&gt;&lt;BR /&gt;
&amp;gt; comma, which is also separator in function&lt;BR /&gt;&lt;BR /&gt;
&amp;gt; arguments.&lt;BR /&gt;&lt;BR /&gt;
&lt;BR /&gt;&lt;BR /&gt;
Yes, this is expected.&lt;BR /&gt;&lt;BR /&gt;
&lt;BR /&gt;&lt;BR /&gt;
&amp;gt; My question is&lt;BR /&gt;&lt;BR /&gt;
...&lt;BR /&gt;&lt;BR /&gt;
&amp;gt; - in case it is only one string, how can i handle&lt;BR /&gt;&lt;BR /&gt;
&amp;gt; special character (comma) in the string?&lt;BR /&gt;&lt;BR /&gt;
&lt;BR /&gt;&lt;BR /&gt;
By quoting, that is, hiding the comma's from macro processor.&lt;BR /&gt;&lt;BR /&gt;
&lt;BR /&gt;&lt;BR /&gt;
&lt;P style="padding:0"&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color:#0000FF;font-family:Courier New;font-size:10pt;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;arr&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color:#0000FF;font-family:Courier New;font-size:10pt;"&gt;%str&lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;('aaa',&amp;nbsp;'bbb',&amp;nbsp;'ccc');&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;P style="padding:0"&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color:#0000FF;font-family:Courier New;font-size:10pt;"&gt;%put&lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;first&amp;nbsp;word&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color:#0000FF;font-family:Courier New;font-size:10pt;"&gt;%scan&lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;(&amp;amp;arr,&amp;nbsp;1,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color:#0000FF;font-family:Courier New;font-size:10pt;"&gt;%str&lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;(,));&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;P style="padding:0"&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color:#0000FF;font-family:Courier New;font-size:10pt;"&gt;%put&lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;second&amp;nbsp;word&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color:#0000FF;font-family:Courier New;font-size:10pt;"&gt;%scan&lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;(&amp;amp;arr,&amp;nbsp;2,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color:#0000FF;font-family:Courier New;font-size:10pt;"&gt;%str&lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;(,));&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;P style="padding:0"&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;%&lt;/SPAN&gt;&lt;SPAN style="color:#008000;font-family:Courier New;font-size:10pt;"&gt;*--&amp;nbsp;on&amp;nbsp;log&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;P style="padding:0"&gt;&lt;SPAN style="color:#008000;font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;first&amp;nbsp;word&amp;nbsp;=&amp;nbsp;'aaa'&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;P style="padding:0"&gt;&lt;SPAN style="color:#008000;font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;second&amp;nbsp;word&amp;nbsp;=&amp;nbsp;&amp;nbsp;'bbb'&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;P style="padding:0"&gt;&lt;SPAN style="color:#008000;font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;--*;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jan 2011 19:53:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/array-string-in-macro-variable/m-p/63511#M18062</guid>
      <dc:creator>chang_y_chung_hotmail_com</dc:creator>
      <dc:date>2011-01-18T19:53:52Z</dc:date>
    </item>
  </channel>
</rss>

