<?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 Help: Loop through datasets and append in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-Help-Loop-through-datasets-and-append/m-p/262516#M310169</link>
    <description>&lt;P&gt;If you don't have any other sets that start with PORT then this might be an alternative. It uses the NAME of the dataset to provide the information and combines all of the datasets at one time.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA PORT_DATA (KEEP=LN_ACCOUNT DER_RPT_DT);
     SET PORT: indsname=SetName;
     IF SUBSTR(STRIP(LN_ACCOUNT),1,1) = 9;
     DER_RPT_DT = PUT((MDY(substr(Setname,8,2),1,substr(Setname,6,2))),MMDDYY10.);
     DER_RPT_Date = MDY(substr(Setname,8,2),1,substr(Setname,6,2));
     FORMAT DER_RPT_DATE MMDDYY10.;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The PORT: (note the : is a list of every dataset&amp;nbsp;that starts with PORT ), the option INDSNAME creates a temporary variable, in this case SetName that will have values of PORT0101FILE PORT0102FILE PORT0103FILE &lt;STRONG&gt;plus the library at the front. &lt;/STRONG&gt;You did not specify that so it is important to mention. If you used the 01 convention then you can find the values of the month and year using substring. The &lt;FONT face="SAS Monospace" size="2"&gt;substr(Setname,&lt;/FONT&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;8&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;2&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;) ignores the library you would need to add the length of the libraryname plus one (for the .) to 8 and 6 respectively.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;I provided two versions one string as you were currently doing and a SAS date value. Keep the one you want, I would recommend the actual date as sorting and other reporting will be ever so much easier.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;Again, this will work if the only sets that start with PORT are the ones you want. If you have others you might try:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;Set Port9: Port0: Port1: indsname= SetName;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;to get those years starting with 9, 0 and 1 IF you don't have other things with that naming convention.&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 08 Apr 2016 16:35:52 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2016-04-08T16:35:52Z</dc:date>
    <item>
      <title>Macro Help: Loop through datasets and append</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Help-Loop-through-datasets-and-append/m-p/262508#M310166</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a library containing monthly datasets back to December 2006 and I would like to loop through each of them, perform my data step logic, and then append them together.&amp;nbsp; I use macros but have never used like this before.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My files are all dated with the following naming convention:&amp;nbsp; N4.BANK.PORT.NOTEyymm.FILE where yymm=0612 for December 2006.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My initial thoughts were to create macro variables for yy and mm and&amp;nbsp;processes using&amp;nbsp;iterative loops to call each file, for example:&lt;/P&gt;
&lt;P&gt;%Macro&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yy=06;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mm=01 to 12;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATA PORT_DATA (KEEP=LN_ACCOUNT DER_RPT_DT);&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET PORT&amp;amp;&amp;amp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;YY&amp;amp;MM.&lt;STRONG&gt;.F&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;ILE;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF SUBSTR(STRIP(LN_ACCOUNT),&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;) = &lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;9&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DER_RPT_DT = PUT((MDY(&amp;amp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;MM.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;,&amp;amp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;YY.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;))&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;MMDDYY10.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FORMAT DER_RPT_DATE &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;MMDDYY10.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RUN;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc append;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; next mm;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yy=yy+1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;
&lt;P&gt;% mend&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My problem is that&amp;nbsp;I'm not sure how to implement, or if this is even the right syntax.&amp;nbsp; Please help me identify a solution!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Jacob&lt;/P&gt;
&lt;P&gt;SAS 9.4&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 16:10:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Help-Loop-through-datasets-and-append/m-p/262508#M310166</guid>
      <dc:creator>Jacob</dc:creator>
      <dc:date>2016-04-08T16:10:13Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Help: Loop through datasets and append</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Help-Loop-through-datasets-and-append/m-p/262511#M310167</link>
      <description>&lt;P&gt;In general, the start of &amp;nbsp;creating a macro is working code for a single iteration. Is your data step provided below the working code you want to implement?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 16:16:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Help-Loop-through-datasets-and-append/m-p/262511#M310167</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-04-08T16:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Help: Loop through datasets and append</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Help-Loop-through-datasets-and-append/m-p/262512#M310168</link>
      <description>&lt;P&gt;Hi Reeza, it is.&amp;nbsp; the only thing missing is the proc append which I assume woudl be as follows:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc append base = hist&amp;nbsp; data=port_data force;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 16:20:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Help-Loop-through-datasets-and-append/m-p/262512#M310168</guid>
      <dc:creator>Jacob</dc:creator>
      <dc:date>2016-04-08T16:20:25Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Help: Loop through datasets and append</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Help-Loop-through-datasets-and-append/m-p/262516#M310169</link>
      <description>&lt;P&gt;If you don't have any other sets that start with PORT then this might be an alternative. It uses the NAME of the dataset to provide the information and combines all of the datasets at one time.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA PORT_DATA (KEEP=LN_ACCOUNT DER_RPT_DT);
     SET PORT: indsname=SetName;
     IF SUBSTR(STRIP(LN_ACCOUNT),1,1) = 9;
     DER_RPT_DT = PUT((MDY(substr(Setname,8,2),1,substr(Setname,6,2))),MMDDYY10.);
     DER_RPT_Date = MDY(substr(Setname,8,2),1,substr(Setname,6,2));
     FORMAT DER_RPT_DATE MMDDYY10.;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The PORT: (note the : is a list of every dataset&amp;nbsp;that starts with PORT ), the option INDSNAME creates a temporary variable, in this case SetName that will have values of PORT0101FILE PORT0102FILE PORT0103FILE &lt;STRONG&gt;plus the library at the front. &lt;/STRONG&gt;You did not specify that so it is important to mention. If you used the 01 convention then you can find the values of the month and year using substring. The &lt;FONT face="SAS Monospace" size="2"&gt;substr(Setname,&lt;/FONT&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;8&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;2&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;) ignores the library you would need to add the length of the libraryname plus one (for the .) to 8 and 6 respectively.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;I provided two versions one string as you were currently doing and a SAS date value. Keep the one you want, I would recommend the actual date as sorting and other reporting will be ever so much easier.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;Again, this will work if the only sets that start with PORT are the ones you want. If you have others you might try:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;Set Port9: Port0: Port1: indsname= SetName;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;to get those years starting with 9, 0 and 1 IF you don't have other things with that naming convention.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 16:35:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Help-Loop-through-datasets-and-append/m-p/262516#M310169</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-04-08T16:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Help: Loop through datasets and append</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Help-Loop-through-datasets-and-append/m-p/262517#M310170</link>
      <description>&lt;P&gt;To loop over dates it is best use the date interval functions like INTCK() and INTNX(). &amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is code that will loop that will increment the macro variable MONTH by one month at a time and format its value in the form YYMM. (0612, 0701, .... 1604). &amp;nbsp;I will leave the exercise of how to read one months data to you.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro loop(out=total,from=,to=);
%local fromdate todate i month ;
%let fromdate = %sysfunc(inputn(&amp;amp;from.01,yymmdd6));
%let todate = %sysfunc(inputn(&amp;amp;to.01,yymmdd6));
%put &amp;amp;=fromdate %sysfunc(putn(&amp;amp;fromdate,date9));
%put &amp;amp;=todate %sysfunc(putn(&amp;amp;todate,date9));
%do i= 0 %to %sysfunc(intck(month,&amp;amp;fromdate,&amp;amp;todate));
  %let month=%sysfunc(intnx(month,&amp;amp;fromdate,&amp;amp;i),YYMMN4);
/* Place code to read data for &amp;amp;month here */
  data current; set ....&amp;amp;month... ; .... run;
/* Now append the current month to the master file */
  proc append data=current base=&amp;amp;out force ; run;
%end;
%mend ;

proc delete data=total ; run;
%loop(out=total,from=0612,to=0705);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Apr 2016 16:37:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Help-Loop-through-datasets-and-append/m-p/262517#M310170</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2016-04-08T16:37:16Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Help: Loop through datasets and append</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Help-Loop-through-datasets-and-append/m-p/262549#M310171</link>
      <description>&lt;P&gt;Thank you both Tom and ballardw.&amp;nbsp; I'm going to give both a go and will mark completed once I am done!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I appreciate your time and help!&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 17:55:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Help-Loop-through-datasets-and-append/m-p/262549#M310171</guid>
      <dc:creator>Jacob</dc:creator>
      <dc:date>2016-04-08T17:55:12Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Help: Loop through datasets and append</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Help-Loop-through-datasets-and-append/m-p/262559#M310172</link>
      <description>&lt;P&gt;So, for the PORT: part... port is a libref assigned as follows:&amp;nbsp; libname PORT "N4.Bank.Port.Note0612.FILE".&amp;nbsp; There are 22 other directories besides the NOTEyymm files that come after "N4.Bank.Port." Such as .ACCTyymm.FILE, COMMyymm.FILE, etc...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I modify this to work with those?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 18:28:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Help-Loop-through-datasets-and-append/m-p/262559#M310172</guid>
      <dc:creator>Jacob</dc:creator>
      <dc:date>2016-04-08T18:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Help: Loop through datasets and append</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Help-Loop-through-datasets-and-append/m-p/262577#M310173</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/6057"&gt;@Jacob&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;So, for the PORT: part... port is a libref assigned as follows:&amp;nbsp; libname PORT "N4.Bank.Port.Note0612.FILE".&amp;nbsp; There are 22 other directories besides the NOTEyymm files that come after "N4.Bank.Port." Such as .ACCTyymm.FILE, COMMyymm.FILE, etc...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I modify this to work with those?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please provide the example names in the SAS form of LIBRARY.DATASET. As it is, I'm not sure now if you have datasets named PORT.PORTYYMM..... or what. Or have you been reassigning the Library for each "file"&lt;/P&gt;
&lt;P&gt;FILES in a directory aren't a concern as much as SAS Datasets in a LIbrary for the code I provided. Or are you doing something with a remote database that hasn't been mentioned.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It might help if you would run the following code and post the result:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc datasets lib=PORT ; 
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Apr 2016 19:48:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Help-Loop-through-datasets-and-append/m-p/262577#M310173</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-04-08T19:48:42Z</dc:date>
    </item>
  </channel>
</rss>

