<?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: macro variable delimiter in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/macro-variable-delimiter/m-p/445471#M13752</link>
    <description>&lt;P&gt;Thank you all! I tried out all the three ways you guys showed, and they all work well. I would definitely look more into "macro quoting" SAS help.&lt;/P&gt;</description>
    <pubDate>Wed, 14 Mar 2018 13:23:08 GMT</pubDate>
    <dc:creator>lizzy28</dc:creator>
    <dc:date>2018-03-14T13:23:08Z</dc:date>
    <item>
      <title>macro variable delimiter</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/macro-variable-delimiter/m-p/444893#M13728</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I came across this question when trying to pull multiple datasets from the same data source. The question is how I can delimit the macro variables when the parameters are defined with multiple numeric values. Below is the example I have. When I tried to plug in the parameters with multiple values like idlist1 and idlist3, the macro cannot take it as the parameters have the same delimiter comma as that between the macro variables "datasetid" and "idlist".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; idlist1=1111, 3333; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; idlist2=2222;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; idlist3=5555,6666,7777;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; pull_iddat(datsetid,idlist);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt; create table want_&amp;amp;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;datsetid.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; as&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;select *&lt;/P&gt;
&lt;P&gt;from libdat.datset_a a&lt;/P&gt;
&lt;P&gt;inner join libdat.datset_b b on a.joinid = b.joinid&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt; and b.idvar in (&amp;amp;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;idlist.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;;quit;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;%&lt;STRONG&gt;&lt;I&gt;pull_iddat&lt;/I&gt;&lt;/STRONG&gt;(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;11&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&amp;amp;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;idlist1.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;%&lt;STRONG&gt;&lt;I&gt;pull_iddat&lt;/I&gt;&lt;/STRONG&gt;(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;22&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&amp;amp;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;idlist2.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;%&lt;STRONG&gt;&lt;I&gt;pull_iddat&lt;/I&gt;&lt;/STRONG&gt;(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;33&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,&amp;amp;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;idlist3.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can anyone help?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks a lot!&lt;/P&gt;
&lt;P&gt;Lizi&lt;/P&gt;</description>
      <pubDate>Mon, 12 Mar 2018 19:12:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/macro-variable-delimiter/m-p/444893#M13728</guid>
      <dc:creator>lizzy28</dc:creator>
      <dc:date>2018-03-12T19:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable delimiter</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/macro-variable-delimiter/m-p/444913#M13730</link>
      <description>&lt;P&gt;Do you wanna quote the macro call:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;%&lt;STRONG&gt;&lt;I&gt;pull_iddat&lt;/I&gt;&lt;/STRONG&gt;(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;11&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;,%&lt;STRONG&gt;bquote&lt;/STRONG&gt;(&amp;amp;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;idlist1.)&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Mar 2018 19:49:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/macro-variable-delimiter/m-p/444913#M13730</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-03-12T19:49:02Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable delimiter</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/macro-variable-delimiter/m-p/444915#M13731</link>
      <description>&lt;P&gt;Ideally, you would create the original variables with a space as a delimiter:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let idlist3=5555 6666 7777;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you would have no problem using &amp;amp;IDLIST3. as a macro parameter.&amp;nbsp; Inside the macro you would have to create a second macro variable.&amp;nbsp; Take 5555 6666 7777 and create a new macro variable with the value:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;5555, 6666, 7777&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are your macro programming skills up to the task?&lt;/P&gt;</description>
      <pubDate>Mon, 12 Mar 2018 19:49:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/macro-variable-delimiter/m-p/444915#M13731</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-03-12T19:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable delimiter</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/macro-variable-delimiter/m-p/444917#M13732</link>
      <description>&lt;P&gt;This is an arcane topic called "macro quoting". I suggest you read up on it in the SAS help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not an expert, so there may be a better way to do it, but I believe this will work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let idlist1=%str(1111, 3333);&lt;BR /&gt;%let idlist2=%str(2222);&lt;BR /&gt;%let idlist3=%str(5555,6666,7777);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;</description>
      <pubDate>Mon, 12 Mar 2018 19:54:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/macro-variable-delimiter/m-p/444917#M13732</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2018-03-12T19:54:41Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable delimiter</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/macro-variable-delimiter/m-p/445471#M13752</link>
      <description>&lt;P&gt;Thank you all! I tried out all the three ways you guys showed, and they all work well. I would definitely look more into "macro quoting" SAS help.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Mar 2018 13:23:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/macro-variable-delimiter/m-p/445471#M13752</guid>
      <dc:creator>lizzy28</dc:creator>
      <dc:date>2018-03-14T13:23:08Z</dc:date>
    </item>
  </channel>
</rss>

