<?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: Send pdf files of sas logs to a newly created folder in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Send-pdf-files-of-sas-logs-to-a-newly-created-folder/m-p/725684#M225455</link>
    <description>&lt;P&gt;1. Why not write into the correct folder directly?&lt;/P&gt;
&lt;P&gt;2. Use function FCOPY() to copy the file to the new location.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Mar 2021 00:59:04 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2021-03-12T00:59:04Z</dc:date>
    <item>
      <title>Send pdf files of sas logs to a newly created folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Send-pdf-files-of-sas-logs-to-a-newly-created-folder/m-p/724835#M225072</link>
      <description>&lt;P&gt;Hi everyone ,&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) I have to create pdf files of the log generated by a sas program which runs on a monthly basis.&lt;/P&gt;&lt;P&gt;2) Send the created pdf file to a newly created folder .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is an example structure of the folder :&lt;/P&gt;&lt;P&gt;Jan2021&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;log.pdf&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have figured out individually , how to create the pdf and the new directory . But I am unable to figure out how to send the pdf to the new folder . Please help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code to create pdf:&lt;/P&gt;&lt;P&gt;filename test "C:/myfolder/new.log";&lt;/P&gt;&lt;P&gt;proc printto log=test new;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc print data=sashelp.cars;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc printtto;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc document name=mynewdoc(write);&lt;BR /&gt;import textfile=test to logfile;&lt;BR /&gt;run;&lt;BR /&gt;ods pdf file="C:/myfolder/myfile.pdf";&lt;BR /&gt;replay;&lt;BR /&gt;run;&lt;BR /&gt;ods pdf close;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;code to create new directory:&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;year=year(today());&lt;BR /&gt;dir_name = put(today(),monname3.)!!"-"!!put(year,4.);&lt;BR /&gt;NewDirectory=dcreate(dir_name,'C:/mynewfolder');&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Mar 2021 12:40:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Send-pdf-files-of-sas-logs-to-a-newly-created-folder/m-p/724835#M225072</guid>
      <dc:creator>kaziumair</dc:creator>
      <dc:date>2021-03-09T12:40:17Z</dc:date>
    </item>
    <item>
      <title>Re: Send pdf files of sas logs to a newly created folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Send-pdf-files-of-sas-logs-to-a-newly-created-folder/m-p/725684#M225455</link>
      <description>&lt;P&gt;1. Why not write into the correct folder directly?&lt;/P&gt;
&lt;P&gt;2. Use function FCOPY() to copy the file to the new location.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Mar 2021 00:59:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Send-pdf-files-of-sas-logs-to-a-newly-created-folder/m-p/725684#M225455</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-03-12T00:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: Send pdf files of sas logs to a newly created folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Send-pdf-files-of-sas-logs-to-a-newly-created-folder/m-p/725712#M225473</link>
      <description>&lt;P&gt;I think you can save the name of the folder you want to create first in a macro variable and use it in the ods pdf statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;at first submit this.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  dir_name = put(today(),monname3.)!!"-"!!put(year(today()),4.);
  call symput('NEWDIR',"C:/mynewfolder/"||dir_name);/* save in macro variable */
  NewDirectory=dcreate(dir_name,'C:/mynewfolder');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;next submit your c&lt;SPAN&gt;ode to create pdf which fix below.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods pdf file="&amp;amp;NEWDIR/myfile.pdf";/* create pdf directly */
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Mar 2021 06:43:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Send-pdf-files-of-sas-logs-to-a-newly-created-folder/m-p/725712#M225473</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2021-03-12T06:43:35Z</dc:date>
    </item>
  </channel>
</rss>

