<?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 Dynamic monthly folder creation and exporting files into the folder in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Dynamic-monthly-folder-creation-and-exporting-files-into-the/m-p/560350#M156684</link>
    <description>&lt;P&gt;i am trying to create folder dynamically for months like below and include the data exported file in the respective folder biweekly,&lt;/P&gt;&lt;P&gt;"D:\Documents\May\test1.xlsx&lt;/P&gt;&lt;P&gt;&amp;nbsp;D:\Documents\May\tes2.xlsx"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have written the below code for creating the monthly folder in the respective directory,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;_null_&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;rootdir=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'D:\Documents\'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;today=today();&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;lastmonth=intnx(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'month'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,today,-&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;dir1=catx(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;' '&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,put(today,&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;monname3.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;),year(today));&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="2"&gt;/*dir2= catx(' ',put(day(today),z2.),'-',put(today,monname3.));*/&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;newdir1=dcreate(dir1,rootdir);&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="2"&gt;/*newdir2=dcreate(dir2,newdir1);*/&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;put (rootdir dir1 newdir1) (=/);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I am stuck after this to&amp;nbsp;export my data(excel file)&amp;nbsp;in these folders dynamically.&amp;nbsp;Can I get any help on this please on how should I go about it, to export my files for every month instead of manually updating the&amp;nbsp;folder everytime?&lt;/P&gt;</description>
    <pubDate>Tue, 21 May 2019 05:14:44 GMT</pubDate>
    <dc:creator>SAS0606</dc:creator>
    <dc:date>2019-05-21T05:14:44Z</dc:date>
    <item>
      <title>Dynamic monthly folder creation and exporting files into the folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dynamic-monthly-folder-creation-and-exporting-files-into-the/m-p/560335#M156681</link>
      <description>&lt;P&gt;i am trying to create folder dynamically for months like below and include the data exported file in the respective folder biweekly,&lt;/P&gt;&lt;P&gt;"D:\Documents\May\test1.xlsx&lt;/P&gt;&lt;P&gt;&amp;nbsp;D:\Documents\May\tes2.xlsx"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have written the below code for creating the monthly folder in the respective directory,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;_null_&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;rootdir=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'D:\Documents\'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;today=today();&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;lastmonth=intnx(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'month'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,today,-&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;dir1=catx(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;' '&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,put(today,&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;monname3.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;),year(today));&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="2"&gt;/*dir2= catx(' ',put(day(today),z2.),'-',put(today,monname3.));*/&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;newdir1=dcreate(dir1,rootdir);&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="2"&gt;/*newdir2=dcreate(dir2,newdir1);*/&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;put (rootdir dir1 newdir1) (=/);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I am stuck after this to&amp;nbsp;export my data(excel file)&amp;nbsp;in these folders dynamically.&amp;nbsp;Can I get any help on this please on how should I go about it, to export my files for every month instead of manually updating the&amp;nbsp;folder everytime?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2019 03:39:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dynamic-monthly-folder-creation-and-exporting-files-into-the/m-p/560335#M156681</guid>
      <dc:creator>SAS0606</dc:creator>
      <dc:date>2019-05-21T03:39:40Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic monthly folder creation and exporting files into the folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dynamic-monthly-folder-creation-and-exporting-files-into-the/m-p/560337#M156682</link>
      <description>&lt;P&gt;ask the person who's code you are trying to replace at your worksite.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am sure that they can assist you and know how to accomplice what you are seeking, since what your are asking is already in your code and has already been done for most of you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2019 03:47:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dynamic-monthly-folder-creation-and-exporting-files-into-the/m-p/560337#M156682</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2019-05-21T03:47:29Z</dc:date>
    </item>
    <item>
      <title>Dynamic monthly folder creation and exporting files into the folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dynamic-monthly-folder-creation-and-exporting-files-into-the/m-p/560350#M156684</link>
      <description>&lt;P&gt;i am trying to create folder dynamically for months like below and include the data exported file in the respective folder biweekly,&lt;/P&gt;&lt;P&gt;"D:\Documents\May\test1.xlsx&lt;/P&gt;&lt;P&gt;&amp;nbsp;D:\Documents\May\tes2.xlsx"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have written the below code for creating the monthly folder in the respective directory,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;_null_&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;rootdir=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'D:\Documents\'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;today=today();&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;lastmonth=intnx(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'month'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,today,-&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;dir1=catx(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;' '&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,put(today,&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;monname3.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;),year(today));&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="2"&gt;/*dir2= catx(' ',put(day(today),z2.),'-',put(today,monname3.));*/&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;newdir1=dcreate(dir1,rootdir);&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="2"&gt;/*newdir2=dcreate(dir2,newdir1);*/&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;put (rootdir dir1 newdir1) (=/);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I am stuck after this to&amp;nbsp;export my data(excel file)&amp;nbsp;in these folders dynamically.&amp;nbsp;Can I get any help on this please on how should I go about it, to export my files for every month instead of manually updating the&amp;nbsp;folder everytime?&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2019 05:14:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dynamic-monthly-folder-creation-and-exporting-files-into-the/m-p/560350#M156684</guid>
      <dc:creator>SAS0606</dc:creator>
      <dc:date>2019-05-21T05:14:44Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic monthly folder creation and exporting files into the folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dynamic-monthly-folder-creation-and-exporting-files-into-the/m-p/560368#M156683</link>
      <description>&lt;P&gt;Add&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;call symputx('exportDir', newdir1);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to the data step you already have. Then, in the exporting steps, replace the path with with the macro-variable exportDir. Could look like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods excel file="&amp;amp;exportDir.\file.xlsx";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2019 06:57:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dynamic-monthly-folder-creation-and-exporting-files-into-the/m-p/560368#M156683</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-05-21T06:57:21Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic monthly folder creation and exporting files into the folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dynamic-monthly-folder-creation-and-exporting-files-into-the/m-p/560377#M156685</link>
      <description>&lt;P&gt;First of all, I would &lt;STRONG&gt;VERY STRONGLY&lt;/STRONG&gt; recommend (in the interest of your future mental sanity) that you not use month&amp;nbsp;&lt;EM&gt;names&lt;/EM&gt;&amp;nbsp;with the year &lt;EM&gt;appended&lt;/EM&gt; as directory names, but proper period designators that sort well and are not dependent on local conventions.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
rootdir = 'D:\Documents\';
today = today();
dir1 = put(today,yymmd7.);
newdir1 = dcreate(dir1,rootdir);
put (rootdir dir1 newdir1) (=/);
call symputx('export_path',catx('\',rootdir,dir1));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;After that, you can use the newly created macro variable in proc export:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc export
  data=mylib.mydata
  datafile="&amp;amp;export_path.\mydata.xlsx"
  dbms=xlsx
  replace
;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 May 2019 07:31:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dynamic-monthly-folder-creation-and-exporting-files-into-the/m-p/560377#M156685</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-05-21T07:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic monthly folder creation and exporting files into the folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dynamic-monthly-folder-creation-and-exporting-files-into-the/m-p/560378#M156686</link>
      <description>&lt;P&gt;PLEASE DO NOT DOUBLE-POST! I just found out that I wasted time on answering a question that had already been sufficiently dealt with by others. And I had to merge the posts.&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2019 07:36:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dynamic-monthly-folder-creation-and-exporting-files-into-the/m-p/560378#M156686</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-05-21T07:36:07Z</dc:date>
    </item>
  </channel>
</rss>

