<?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 Macro that goes through all dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-that-goes-through-all-dataset/m-p/214552#M39594</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am new to SAS and I was given this macro,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%mend create_libraries;&lt;/P&gt;&lt;P&gt;%create_libraries;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro Dt_extract(directory);&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;select count(*)&lt;/P&gt;&lt;P&gt;into:n_names&lt;/P&gt;&lt;P&gt;from&amp;nbsp; &amp;amp;directory..flname_ann;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;%do z=1 %to &amp;amp;n_names;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;data _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;a bunch of code&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;%mend Dt_extract;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%Dt_extract(temp);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is data set name flname_ann. Within it is a list of all the names of SAS dataset that I want to go through. So this macro essentially goes through all the dataset, do some modification and towards the end I add in a proc append and end up with a new table with all the modified dataset combined. &lt;/P&gt;&lt;P&gt;Now, within the same folder where I save the flname_ann file, there is another similar dataset with another list of files that I wish to go through. Can someone please explain to me how can I call up the same macro to read this other file, named flname_non? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 02 Apr 2015 00:36:46 GMT</pubDate>
    <dc:creator>Brian_Chee</dc:creator>
    <dc:date>2015-04-02T00:36:46Z</dc:date>
    <item>
      <title>Macro that goes through all dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-that-goes-through-all-dataset/m-p/214552#M39594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am new to SAS and I was given this macro,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%mend create_libraries;&lt;/P&gt;&lt;P&gt;%create_libraries;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro Dt_extract(directory);&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;select count(*)&lt;/P&gt;&lt;P&gt;into:n_names&lt;/P&gt;&lt;P&gt;from&amp;nbsp; &amp;amp;directory..flname_ann;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;%do z=1 %to &amp;amp;n_names;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;data _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;a bunch of code&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;%mend Dt_extract;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%Dt_extract(temp);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is data set name flname_ann. Within it is a list of all the names of SAS dataset that I want to go through. So this macro essentially goes through all the dataset, do some modification and towards the end I add in a proc append and end up with a new table with all the modified dataset combined. &lt;/P&gt;&lt;P&gt;Now, within the same folder where I save the flname_ann file, there is another similar dataset with another list of files that I wish to go through. Can someone please explain to me how can I call up the same macro to read this other file, named flname_non? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Apr 2015 00:36:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-that-goes-through-all-dataset/m-p/214552#M39594</guid>
      <dc:creator>Brian_Chee</dc:creator>
      <dc:date>2015-04-02T00:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: Macro that goes through all dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-that-goes-through-all-dataset/m-p/214553#M39595</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is untested but it should work. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%macro Dt_extract(directory=,file=);&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;proc sql noprint;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;select count(*)&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;into:n_names&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;from&amp;nbsp; &amp;amp;directory..&amp;amp;file.;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;quit;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;%do z=1 %to &amp;amp;n_names;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;data _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-family: inherit;"&gt;&lt;EM&gt;a bunch of code&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%end;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%mend Dt_extract;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;%Dt_extract(directory=temp,file=&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;flname_ann&lt;/SPAN&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;%Dt_extract(directory=temp,file=&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;flname_non&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Apr 2015 16:22:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-that-goes-through-all-dataset/m-p/214553#M39595</guid>
      <dc:creator>jwillis</dc:creator>
      <dc:date>2015-04-02T16:22:29Z</dc:date>
    </item>
    <item>
      <title>Re: Macro that goes through all dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-that-goes-through-all-dataset/m-p/214554#M39596</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It works perfectly! Thank you very much.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Apr 2015 17:18:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-that-goes-through-all-dataset/m-p/214554#M39596</guid>
      <dc:creator>Brian_Chee</dc:creator>
      <dc:date>2015-04-02T17:18:01Z</dc:date>
    </item>
  </channel>
</rss>

