<?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: create a series of file names! in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/create-a-series-of-file-names/m-p/291919#M60504</link>
    <description>&lt;P&gt;You could change month&amp;amp;i to this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;month%sysfunc(putn(&amp;amp;i,z4))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that this code requires you to have 1500 FILENAME statements.&amp;nbsp; Depending on what is in them, you might have to apply the same changes to in&amp;amp;i as well.&lt;/P&gt;</description>
    <pubDate>Tue, 16 Aug 2016 14:47:03 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2016-08-16T14:47:03Z</dc:date>
    <item>
      <title>create a series of file names!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-a-series-of-file-names/m-p/291914#M60503</link>
      <description>&lt;P&gt;The following is an example from SAS:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro create(howmany);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; %do i=1 %to &amp;amp;howmany;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data month&amp;amp;i;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; infile in&amp;amp;i;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input product cost date;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; %end;&lt;/P&gt;
&lt;P&gt;%mend create;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;%create(3)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have about 1500 files. I want to create files with names such as&lt;/P&gt;
&lt;P&gt;month0001; month0002; month0003; ..... month1949; month1950; rather than month1, month2, .... month1949, month1950.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have any suggestions?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your help,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 14:21:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-a-series-of-file-names/m-p/291914#M60503</guid>
      <dc:creator>vxhong17</dc:creator>
      <dc:date>2016-08-16T14:21:06Z</dc:date>
    </item>
    <item>
      <title>Re: create a series of file names!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-a-series-of-file-names/m-p/291919#M60504</link>
      <description>&lt;P&gt;You could change month&amp;amp;i to this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;month%sysfunc(putn(&amp;amp;i,z4))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that this code requires you to have 1500 FILENAME statements.&amp;nbsp; Depending on what is in them, you might have to apply the same changes to in&amp;amp;i as well.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 14:47:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-a-series-of-file-names/m-p/291919#M60504</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-08-16T14:47:03Z</dc:date>
    </item>
    <item>
      <title>Re: create a series of file names!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-a-series-of-file-names/m-p/291920#M60505</link>
      <description>&lt;P&gt;Firstly, and most importantly, don't. &amp;nbsp;Why would you want to try to program with thousands of seprate datasets? &amp;nbsp;It is both unefficient and will make your coding efforts far more complicated and unstable? &amp;nbsp;SAS is built around the concept of by group processing, that is performing the same procedure or datastep of a set of data called groups. &amp;nbsp;So the best way would be to create a dataset with all your data, and have an additional column call it month for instance. &amp;nbsp;This would be your incrementor, you could thne use it in procedures for example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc print data=have;
  by month;
  title "The month is #byval1";
run;&lt;/PRE&gt;
&lt;P&gt;That is so much simpler than writing 1500 print steps, or a mass of messy unmaintable macro code. &amp;nbsp;To get one dataset simply use (again the power of prefixes):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data month;
  set in: indsname=name;
run;&lt;/PRE&gt;
&lt;P&gt;Also finally, its not clear to me what you are doing, are these datasets, or are they extermal files? &amp;nbsp;You have an infile statement by in&amp;amp;i. is not referencing anything (unless you have setup 1500 filerefs?).&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 14:47:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-a-series-of-file-names/m-p/291920#M60505</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-08-16T14:47:33Z</dc:date>
    </item>
    <item>
      <title>Re: create a series of file names!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-a-series-of-file-names/m-p/291929#M60507</link>
      <description>&lt;P&gt;Thank you so much for your help, &lt;SPAN&gt;Astounding.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;It works. &lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 15:33:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-a-series-of-file-names/m-p/291929#M60507</guid>
      <dc:creator>vxhong17</dc:creator>
      <dc:date>2016-08-16T15:33:05Z</dc:date>
    </item>
    <item>
      <title>Re: create a series of file names!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-a-series-of-file-names/m-p/291933#M60508</link>
      <description>&lt;P&gt;Thank you so much for your advice. RW9&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Actually, I need to export a very large dataset to txt files for my friend. He uses Matlab.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 15:44:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-a-series-of-file-names/m-p/291933#M60508</guid>
      <dc:creator>vxhong17</dc:creator>
      <dc:date>2016-08-16T15:44:49Z</dc:date>
    </item>
    <item>
      <title>Re: create a series of file names!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-a-series-of-file-names/m-p/291936#M60510</link>
      <description>&lt;P&gt;Well, regardles of software, one file to read in would be far easier for them as well. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also note, your code is not right. &amp;nbsp;You don't create external file with datastep infile statements, that is for reading in files?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 16:04:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-a-series-of-file-names/m-p/291936#M60510</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-08-16T16:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: create a series of file names!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-a-series-of-file-names/m-p/292026#M60542</link>
      <description>&lt;P&gt;Hi RW9,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I agree with you that it is easier to deal with one file rather than mutiple files.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I only showed an example from SAS. I did not provide all steps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you so much for your help,&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 23:39:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-a-series-of-file-names/m-p/292026#M60542</guid>
      <dc:creator>vxhong17</dc:creator>
      <dc:date>2016-08-16T23:39:42Z</dc:date>
    </item>
  </channel>
</rss>

