<?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: Appending multiple datasets using macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Appending-multiple-datasets-using-macro/m-p/193645#M36399</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;If your library not cluttered with similar table names then dataset lists could solve the problem.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt; font-style: inherit; font-weight: inherit; line-height: 1.5em;"&gt;&amp;nbsp; set direc.prod_P1_201: ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Or &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt; font-style: inherit; font-weight: inherit;"&gt;&amp;nbsp; set direc.prod_P1_2013_: &lt;SPAN style="font-family: 'courier new', courier; font-size: 16px;"&gt;direc.prod_P1_2014_: &lt;SPAN style="font-family: 'courier new', courier; font-size: 16px;"&gt;direc.prod_P1_2015_: &lt;/SPAN&gt;&lt;/SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt; font-style: inherit; font-weight: inherit;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;What is the selection logic for which dataset to include?&amp;nbsp; &lt;/P&gt;&lt;P&gt;Can the selection logic be imbedded into the data step instead by selecting on a variable in the dataset? Or by using INDSNAME= option to generate a variable with the data set name.&lt;/P&gt;&lt;P&gt;You can also pull dataset names from metadata such as DICTIONARY.TABLES.&lt;/P&gt;&lt;P&gt;proc sql noprint ;&lt;/P&gt;&lt;P&gt; select catx(',',libname,memname) into :dslist separated by ' '&lt;/P&gt;&lt;P&gt;from dictionary.tables &lt;/P&gt;&lt;P&gt;where libname='DIREC'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; and memname like 'PROD^_P1^_201%^_%' escape '^'&lt;/P&gt;&lt;P&gt;order by libname,memname&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;...set &amp;amp;dslist ;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 Mar 2015 02:02:25 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2015-03-05T02:02:25Z</dc:date>
    <item>
      <title>Appending multiple datasets using macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Appending-multiple-datasets-using-macro/m-p/193641#M36395</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;Hi all,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;I have a following code which unions the dataset for each month of the year. I want to write a macro for it so that the manual intervention of copying the same query for each month can be avoided. Please help.&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;select distinct PName,PAdd,PCity&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;from Direc.Prod_P1_2014_12 where PNumber is not null&lt;/P&gt;&lt;P&gt;&lt;STRONG style="line-height: 1.5em; font-size: 10pt;"&gt;union&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;select distinct &lt;SPAN style="font-size: 13.3333330154419px;"&gt;PName,PAdd,PCity&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;from Direc.Prod_P1_2014_11 where PNumber is not null&lt;/P&gt;&lt;P&gt;&lt;STRONG style="line-height: 1.5em; font-size: 10pt;"&gt;union&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;select distinct &lt;SPAN style="font-size: 13.3333330154419px;"&gt;PName,PAdd,PCity&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;from Direc.Prod_P1_2014_10 where PNumber is not null&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;.&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;.&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;.&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;STRONG&gt;union&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;select distinct &lt;SPAN style="font-size: 13.3333330154419px;"&gt;PName,PAdd,PCity&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;from Direc.Prod_P1_2014_01 where PNumber is not null&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Mar 2015 07:39:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Appending-multiple-datasets-using-macro/m-p/193641#M36395</guid>
      <dc:creator>KP12</dc:creator>
      <dc:date>2015-03-04T07:39:13Z</dc:date>
    </item>
    <item>
      <title>Re: Appending multiple datasets using macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Appending-multiple-datasets-using-macro/m-p/193642#M36396</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have written the following macro code for the above issue, which is working fine for me. But can I optimise it further ? As the month values in the dataset name are mentioned as 01, 02...09, but SAS is resolving the values as 1,2,3...9. Is there any solution available for this issue, so that I can provide only a single DO loop for the month ? &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;%macro product;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %do i=2014 %to 2015;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %do i=1 %to 9;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %if %sysfunc(exist(Direc.Prod_P1_&amp;amp;i._0&amp;amp;j.)) %then %do;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Direc.Prod_P1_&amp;amp;i._&amp;amp;j.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %end; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %do i=10 %to i=12;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %if %sysfunc(exist(Direc.Prod_P1_&amp;amp;i._&amp;amp;j.)) %then %do;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Direc.Prod_P1_&amp;amp;i._&amp;amp;j.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;%mend;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2015 01:10:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Appending-multiple-datasets-using-macro/m-p/193642#M36396</guid>
      <dc:creator>KP12</dc:creator>
      <dc:date>2015-03-05T01:10:22Z</dc:date>
    </item>
    <item>
      <title>Re: Appending multiple datasets using macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Appending-multiple-datasets-using-macro/m-p/193643#M36397</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why not write it in SAS instead of SQL?&amp;nbsp; Then no need for a macro since you can use a dataset list.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;data want ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;&amp;nbsp; set direc.prod_P1_2014_: ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;&amp;nbsp; where PNUMBER is not null;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;&amp;nbsp; keep pname padd pcity ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;proc sort nodupkey ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;&amp;nbsp; by pname padd pcity;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2015 01:17:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Appending-multiple-datasets-using-macro/m-p/193643#M36397</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-03-05T01:17:02Z</dc:date>
    </item>
    <item>
      <title>Re: Appending multiple datasets using macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Appending-multiple-datasets-using-macro/m-p/193644#M36398</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your reply Tom.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry, I missed one part in my query, actually I need to repeat this code for each month from 2013 onwards till now, I have written one macro for the same &amp;amp; had posted it here but it is pending for approval with the admin, once it will be approved kindly share your valuable insights on the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Though if some modification can be done in your code addressing my issue, kindly share that as well.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2015 01:28:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Appending-multiple-datasets-using-macro/m-p/193644#M36398</guid>
      <dc:creator>KP12</dc:creator>
      <dc:date>2015-03-05T01:28:40Z</dc:date>
    </item>
    <item>
      <title>Re: Appending multiple datasets using macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Appending-multiple-datasets-using-macro/m-p/193645#M36399</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;If your library not cluttered with similar table names then dataset lists could solve the problem.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt; font-style: inherit; font-weight: inherit; line-height: 1.5em;"&gt;&amp;nbsp; set direc.prod_P1_201: ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Or &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt; font-style: inherit; font-weight: inherit;"&gt;&amp;nbsp; set direc.prod_P1_2013_: &lt;SPAN style="font-family: 'courier new', courier; font-size: 16px;"&gt;direc.prod_P1_2014_: &lt;SPAN style="font-family: 'courier new', courier; font-size: 16px;"&gt;direc.prod_P1_2015_: &lt;/SPAN&gt;&lt;/SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt; font-style: inherit; font-weight: inherit;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;What is the selection logic for which dataset to include?&amp;nbsp; &lt;/P&gt;&lt;P&gt;Can the selection logic be imbedded into the data step instead by selecting on a variable in the dataset? Or by using INDSNAME= option to generate a variable with the data set name.&lt;/P&gt;&lt;P&gt;You can also pull dataset names from metadata such as DICTIONARY.TABLES.&lt;/P&gt;&lt;P&gt;proc sql noprint ;&lt;/P&gt;&lt;P&gt; select catx(',',libname,memname) into :dslist separated by ' '&lt;/P&gt;&lt;P&gt;from dictionary.tables &lt;/P&gt;&lt;P&gt;where libname='DIREC'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; and memname like 'PROD^_P1^_201%^_%' escape '^'&lt;/P&gt;&lt;P&gt;order by libname,memname&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;...set &amp;amp;dslist ;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2015 02:02:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Appending-multiple-datasets-using-macro/m-p/193645#M36399</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-03-05T02:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: Appending multiple datasets using macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Appending-multiple-datasets-using-macro/m-p/193646#M36400</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;%macro&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &lt;STRONG&gt;&lt;EM&gt;product&lt;/EM&gt;&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%local&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; year month dsname ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; year=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;2014&lt;/STRONG&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%to&lt;/SPAN&gt; &lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;2015&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; month=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%to&lt;/SPAN&gt; &lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;12&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; dsname=DIREC.PROD_P1_&amp;amp;year._&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;(putn(&amp;amp;month,Z2));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%if&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;(exist(&amp;amp;dsname)) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%then&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &amp;amp;dsname ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;%mend&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;data want ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; set %product ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;...&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2015 02:05:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Appending-multiple-datasets-using-macro/m-p/193646#M36400</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-03-05T02:05:32Z</dc:date>
    </item>
    <item>
      <title>Re: Appending multiple datasets using macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Appending-multiple-datasets-using-macro/m-p/193647#M36401</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It worked like a charm Tom, thank you very much &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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2015 02:16:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Appending-multiple-datasets-using-macro/m-p/193647#M36401</guid>
      <dc:creator>KP12</dc:creator>
      <dc:date>2015-03-05T02:16:42Z</dc:date>
    </item>
    <item>
      <title>Re: Appending multiple datasets using macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Appending-multiple-datasets-using-macro/m-p/193648#M36402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can do time loops using INTNX and INTCK functions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;%macro&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; product(start,end);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%local&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; i n month dsname ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; i=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;0&lt;/STRONG&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%to&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;(intck(month,&amp;amp;start,&amp;amp;end));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; month=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;(intnx(month,&amp;amp;start,&amp;amp;i),yymmdds10);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; dsname=DIREC.PROD_P1_&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;(tranwrd(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%substr&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;(&amp;amp;month,1,7),/,_));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%if&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;(exist(&amp;amp;dsname)) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%then&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &amp;amp;dsname ; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;%mend&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%put&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; %product('01NOV2013'd,'01MAR2014'd);&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2015 02:18:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Appending-multiple-datasets-using-macro/m-p/193648#M36402</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-03-05T02:18:46Z</dc:date>
    </item>
    <item>
      <title>Re: Appending multiple datasets using macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Appending-multiple-datasets-using-macro/m-p/193649#M36403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;what the following line will do in your program?&lt;/P&gt;&lt;P&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;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%if&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;SPAN style="font-size: 10pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New'; color: black; background: white;"&gt;(exist(&amp;amp;dsname)) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%then&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New'; color: black; background: white;"&gt; &amp;amp;dsname ;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2015 09:14:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Appending-multiple-datasets-using-macro/m-p/193649#M36403</guid>
      <dc:creator>RamKumar</dc:creator>
      <dc:date>2015-03-05T09:14:13Z</dc:date>
    </item>
    <item>
      <title>Re: Appending multiple datasets using macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Appending-multiple-datasets-using-macro/m-p/193650#M36404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The main purpose of a SAS macro is to conditionally generate SAS code.&lt;/P&gt;&lt;P&gt;This macro in particular will generate a list of dataset names.&lt;/P&gt;&lt;P&gt;So that line tests if the dataset exists and if it does it produces the dataset name as part of the SAS code that the macro is generating.&amp;nbsp; If the dataset doesn't exist then no SAS code is generated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2015 13:02:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Appending-multiple-datasets-using-macro/m-p/193650#M36404</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-03-05T13:02:59Z</dc:date>
    </item>
    <item>
      <title>Re: Appending multiple datasets using macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Appending-multiple-datasets-using-macro/m-p/234994#M43015</link>
      <description>&lt;P&gt;Hi Tom,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm curious how the macro you created will work if you add a LIBNAME to the code? Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2015 12:58:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Appending-multiple-datasets-using-macro/m-p/234994#M43015</guid>
      <dc:creator>Yawkusi</dc:creator>
      <dc:date>2015-11-17T12:58:30Z</dc:date>
    </item>
  </channel>
</rss>

