<?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: Set Multiple Datasets Using Macors ?? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Set-Multiple-Datasets-Using-Macors/m-p/115216#M31863</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In case your wondering, Reeza's code does the exact same thing without the fuss of using the macro processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I would use his for efficiency sake plus simplicity of code! I was attempting to solve the problem in your method however, so sorry for not pointing that out. (I recently learned about the colon operator myself)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 17 Oct 2013 19:20:47 GMT</pubDate>
    <dc:creator>Anotherdream</dc:creator>
    <dc:date>2013-10-17T19:20:47Z</dc:date>
    <item>
      <title>Set Multiple Datasets Using Macors ??</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Set-Multiple-Datasets-Using-Macors/m-p/115213#M31860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a data step that reads multiple datasets.&amp;nbsp; I run this report once every month and the input datasets change every month.&amp;nbsp; I am trying to automate this job so there will be no manual updates to the code.&amp;nbsp; The code below utilizes dictionary.member to select all the datasets starting with the name 'REASON' in the libname 'PERM'.&amp;nbsp; Then I select these dataset names into a macro variable.&amp;nbsp; The code works fine.&amp;nbsp; The problem is I can't utilize the macro variable in the set statement for my data step (where you see the '???'). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to fix my approach?&amp;nbsp; Are there are other ways to accomplish this task?&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I really appreciate any input you may have &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table reasons as&lt;/P&gt;&lt;P&gt;select distinct memname&lt;/P&gt;&lt;P&gt;from&lt;/P&gt;&lt;P&gt;dictionary.members&lt;/P&gt;&lt;P&gt;where upcase(libname) = 'PERM'&lt;/P&gt;&lt;P&gt;and upcase(memname) like 'REASON%';&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc sql;&lt;/P&gt;&lt;P&gt;select distinct quote(memname) into :mem_list&lt;/P&gt;&lt;P&gt;seperated by ', '&lt;/P&gt;&lt;P&gt;from reasons;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data combine;&lt;/P&gt;&lt;P&gt;set ????&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Oct 2013 19:04:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Set-Multiple-Datasets-Using-Macors/m-p/115213#M31860</guid>
      <dc:creator>KevinC_</dc:creator>
      <dc:date>2013-10-17T19:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: Set Multiple Datasets Using Macors ??</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Set-Multiple-Datasets-Using-Macors/m-p/115214#M31861</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;your macro creation is incorrect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are sepearting them by a comma, but the sas set statement doesn't allow commas. SO just change it to separated by a space. aka change your code too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;select distinct quote(memname) into :mem_list&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Separated by ' ' &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;from reasons;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data combine;&lt;/P&gt;&lt;P&gt;set &amp;amp;mem_list;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will work&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Oct 2013 19:10:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Set-Multiple-Datasets-Using-Macors/m-p/115214#M31861</guid>
      <dc:creator>Anotherdream</dc:creator>
      <dc:date>2013-10-17T19:10:36Z</dc:date>
    </item>
    <item>
      <title>Re: Set Multiple Datasets Using Macors ??</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Set-Multiple-Datasets-Using-Macors/m-p/115215#M31862</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="5253" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt; I think it would also need to concatenate the libname and memname somehow instead of just the memname. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use Colon Operator (:)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data combine;&lt;/P&gt;&lt;P&gt;set perm.reason:;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Oct 2013 19:14:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Set-Multiple-Datasets-Using-Macors/m-p/115215#M31862</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-10-17T19:14:53Z</dc:date>
    </item>
    <item>
      <title>Re: Set Multiple Datasets Using Macors ??</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Set-Multiple-Datasets-Using-Macors/m-p/115216#M31863</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In case your wondering, Reeza's code does the exact same thing without the fuss of using the macro processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I would use his for efficiency sake plus simplicity of code! I was attempting to solve the problem in your method however, so sorry for not pointing that out. (I recently learned about the colon operator myself)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Oct 2013 19:20:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Set-Multiple-Datasets-Using-Macors/m-p/115216#M31863</guid>
      <dc:creator>Anotherdream</dc:creator>
      <dc:date>2013-10-17T19:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: Set Multiple Datasets Using Macors ??</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Set-Multiple-Datasets-Using-Macors/m-p/115217#M31864</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much Reeza and Anotherdream for your input !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I modified my code using the colon operator:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data combine;&lt;/P&gt;&lt;P&gt;set perm.reason:;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It generated these errors:&lt;/P&gt;&lt;P&gt;"ERROR: File PERM.REASON.DATA does not exist.&amp;nbsp; Syntax error, expecting one of the following: a name, a quoted string,..."&lt;/P&gt;&lt;P&gt;"ERROR 200-322: The symbol is not reconized and will be ignored."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After seeing the errors I did a little test:&amp;nbsp; I changed the set statement to "set perm.reason_2013_09" and it worked just fine.&amp;nbsp; So this tells me the file(s) are there.&amp;nbsp; It seems to have problems with the colon?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions?&amp;nbsp; Thanks again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Btw, i use SAS 9.1.3&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Oct 2013 19:47:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Set-Multiple-Datasets-Using-Macors/m-p/115217#M31864</guid>
      <dc:creator>KevinC_</dc:creator>
      <dc:date>2013-10-17T19:47:35Z</dc:date>
    </item>
    <item>
      <title>Re: Set Multiple Datasets Using Macors ??</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Set-Multiple-Datasets-Using-Macors/m-p/115218#M31865</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think the colon is introduced for datasets from 9.2 +&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyways try this (untested):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;select catx(".", libname, memname) into :mem_list&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Separated by ' ' &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;from reasons;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data combine;&lt;/P&gt;&lt;P&gt;set &amp;amp;mem_list;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Oct 2013 19:57:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Set-Multiple-Datasets-Using-Macors/m-p/115218#M31865</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-10-17T19:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: Set Multiple Datasets Using Macors ??</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Set-Multiple-Datasets-Using-Macors/m-p/115219#M31866</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Reeza,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your code worked!!&amp;nbsp; The colon operator seems pretty slick.&amp;nbsp; Too bad our SAS version doesn't support it.&lt;/P&gt;&lt;P&gt;Thank you again &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kevin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Oct 2013 20:18:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Set-Multiple-Datasets-Using-Macors/m-p/115219#M31866</guid>
      <dc:creator>KevinC_</dc:creator>
      <dc:date>2013-10-17T20:18:38Z</dc:date>
    </item>
  </channel>
</rss>

