<?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: Data Step Append Many Tables selected dates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Data-Step-Append-Many-Tables-selected-dates/m-p/214721#M39641</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I knew there must be a way to do it in one step!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 02 Apr 2015 08:40:24 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2015-04-02T08:40:24Z</dc:date>
    <item>
      <title>Data Step Append Many Tables selected dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Step-Append-Many-Tables-selected-dates/m-p/214718#M39638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are many data sets in a library, as below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CUST_201501&lt;/P&gt;&lt;P&gt;CUST_201502&lt;/P&gt;&lt;P&gt;CUST_201503&lt;/P&gt;&lt;P&gt;CUST_20150306&lt;/P&gt;&lt;P&gt;CUST_20150313&lt;/P&gt;&lt;P&gt;CUST_20150320&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CUST_201501 is the month-end data for January&lt;/P&gt;&lt;P&gt;CUST_201503 is the month-end data for March&lt;/P&gt;&lt;P&gt;CUST_20150306 is the week-end data for 06th March 2015&lt;/P&gt;&lt;P&gt;CUST_20150313 is the week-end data for 13th March 2015&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to achieve this:&lt;/P&gt;&lt;PRE __default_attr="html" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14279532583026356" jivemacro_uid="_14279532583026356"&gt;
&lt;P&gt;data CUST_weekly;&lt;/P&gt;
&lt;P&gt;set&lt;/P&gt;
&lt;P&gt;CUST_20150306&lt;/P&gt;
&lt;P&gt;CUST_20150313&lt;/P&gt;
&lt;P&gt;CUST_20150320&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;


&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I go about automating the above? The below is the best I can come up with. Where do I put the SET statement?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data cust_weekly;&lt;/P&gt;&lt;P&gt;misdate='06MAR2015'd;&lt;/P&gt;&lt;P&gt;format misdate yymmddn8.;&lt;/P&gt;&lt;P&gt;j=1;&lt;/P&gt;&lt;P&gt;do while (j lt 5);&lt;/P&gt;&lt;P&gt;&amp;nbsp; j+ +1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; put misdate=;&lt;/P&gt;&lt;P&gt;&amp;nbsp; misdate=intnx('days',misdate,7);&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Apr 2015 05:38:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Step-Append-Many-Tables-selected-dates/m-p/214718#M39638</guid>
      <dc:creator>hellind</dc:creator>
      <dc:date>2015-04-02T05:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: Data Step Append Many Tables selected dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Step-Append-Many-Tables-selected-dates/m-p/214719#M39639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If I interpret you right, you want to automate the set statement so that all weekly datasets for a given month are used for input.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table int as&lt;/P&gt;&lt;P&gt;select libname, memname from dictionary.tables where libname='libname' and memname contains 'CUST_201503';&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;set int end=the_end;&lt;/P&gt;&lt;P&gt;length macrovar $ 200;&lt;/P&gt;&lt;P&gt;retain macrovar "";&lt;/P&gt;&lt;P&gt;macrovar=catx(" ",macrovar,trim(libname)!!'.'!!trim(memname));&lt;/P&gt;&lt;P&gt;if the_end then call symput('memnames',macrovar);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data cust_weekly;&lt;/P&gt;&lt;P&gt;set &amp;amp;memnames;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Apr 2015 07:41:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Step-Append-Many-Tables-selected-dates/m-p/214719#M39639</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-04-02T07:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: Data Step Append Many Tables selected dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Step-Append-Many-Tables-selected-dates/m-p/214720#M39640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Data-step and proc sql in one step:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; proc sql noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select catx('.', libname, memname)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; into :memnames separated by ' '&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from sashelp.vtable&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where libname = 'libname' and memname contains 'CUST_201503'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Apr 2015 08:24:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Step-Append-Many-Tables-selected-dates/m-p/214720#M39640</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2015-04-02T08:24:07Z</dc:date>
    </item>
    <item>
      <title>Re: Data Step Append Many Tables selected dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Step-Append-Many-Tables-selected-dates/m-p/214721#M39641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I knew there must be a way to do it in one step!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Apr 2015 08:40:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Step-Append-Many-Tables-selected-dates/m-p/214721#M39641</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-04-02T08:40:24Z</dc:date>
    </item>
    <item>
      <title>Re: Data Step Append Many Tables selected dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Step-Append-Many-Tables-selected-dates/m-p/214722#M39642</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to pick the weekly data in YYYMMDD suffix but not the monthly data in YYYYMM suffix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I could not use wildcard set statement.&lt;/P&gt;&lt;P&gt;data cust_weekly;&lt;/P&gt;&lt;P&gt;set cust_201503:;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hence i will use yours:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp; proc sql noprint;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select catx('.', libname, memname)&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; into :memnames separated by ' '&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from sashelp.vtable&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where libname = 'libname' and memname contains 'CUST_201503'&amp;nbsp; and&amp;nbsp; length(memname) = 20&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp; quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Apr 2015 10:07:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Step-Append-Many-Tables-selected-dates/m-p/214722#M39642</guid>
      <dc:creator>hellind</dc:creator>
      <dc:date>2015-04-02T10:07:45Z</dc:date>
    </item>
  </channel>
</rss>

