<?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: Filename should be same as specified date in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Filename-should-be-same-as-specified-date/m-p/850716#M37275</link>
    <description>But, what if I want to store yesterday's date. Then how can do that?</description>
    <pubDate>Thu, 22 Dec 2022 05:59:29 GMT</pubDate>
    <dc:creator>Kirito1</dc:creator>
    <dc:date>2022-12-22T05:59:29Z</dc:date>
    <item>
      <title>Filename should be same as specified date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Filename-should-be-same-as-specified-date/m-p/850709#M37270</link>
      <description>&lt;P&gt;First I was trying to give the filename the exact date on which I exported the file.&lt;/P&gt;&lt;P&gt;proc export data=AVG&lt;BR /&gt;outfile="xyz/Transactions \%sysfunc( today(), date9 ).csv"&lt;BR /&gt;REPLACE&lt;BR /&gt;DBMS=CSV;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;This is giving me an output filename as&amp;nbsp; (Transactions 22DEC2022).&lt;/P&gt;&lt;P&gt;--------------&lt;/P&gt;&lt;P&gt;But now I want the date which I specify in a code should be attached with the File name.&lt;/P&gt;&lt;P&gt;For Example: I specified a date in code as 19DEC2022&amp;nbsp; and the file name is Transactions. So, the output filename should be Transactions 19DEC2022.&lt;/P&gt;&lt;P&gt;I think this problem could be solved using macros but I am not sure how to proceed it. Please! help.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2022 05:22:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Filename-should-be-same-as-specified-date/m-p/850709#M37270</guid>
      <dc:creator>Kirito1</dc:creator>
      <dc:date>2022-12-22T05:22:16Z</dc:date>
    </item>
    <item>
      <title>Re: Filename should be same as specified date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Filename-should-be-same-as-specified-date/m-p/850710#M37271</link>
      <description>&lt;P&gt;From longtime IT experience, two tips:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;do not use DMY dates in filenames. Use YMD instead, so the files sort in chronological order on their own, and it is easiervto use wildcards to pick years or months.&lt;/LI&gt;
&lt;LI&gt;avoid blanks in filenames. Use underlines instead.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;How do you "specify a date in a code"? Please show that particular piece of code.&lt;/P&gt;
&lt;P&gt;Use the "little running man" button to open a window into which you paste the code. This keeps formatting, leaves the code as is (no HTML formatting), and provides coloring similar to the SAS Enhanced Editor.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2022 05:32:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Filename-should-be-same-as-specified-date/m-p/850710#M37271</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-12-22T05:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: Filename should be same as specified date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Filename-should-be-same-as-specified-date/m-p/850712#M37273</link>
      <description>That's the question how can I just name a file using the date I specify. Sorry I think this is a bit confusing but is there a way where we %let to specify date and then just like called today(), I could call a date that I want with the file name to attach.</description>
      <pubDate>Thu, 22 Dec 2022 05:36:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Filename-should-be-same-as-specified-date/m-p/850712#M37273</guid>
      <dc:creator>Kirito1</dc:creator>
      <dc:date>2022-12-22T05:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: Filename should be same as specified date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Filename-should-be-same-as-specified-date/m-p/850714#M37274</link>
      <description>&lt;P&gt;To store today's date in a macro variable, do&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let today = %sysfunc(today(),yymmddn8.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want to use the date in code (for calculations or comparisons), omit the format in %SYSFUNC.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2022 05:47:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Filename-should-be-same-as-specified-date/m-p/850714#M37274</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-12-22T05:47:23Z</dc:date>
    </item>
    <item>
      <title>Re: Filename should be same as specified date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Filename-should-be-same-as-specified-date/m-p/850716#M37275</link>
      <description>But, what if I want to store yesterday's date. Then how can do that?</description>
      <pubDate>Thu, 22 Dec 2022 05:59:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Filename-should-be-same-as-specified-date/m-p/850716#M37275</guid>
      <dc:creator>Kirito1</dc:creator>
      <dc:date>2022-12-22T05:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: Filename should be same as specified date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Filename-should-be-same-as-specified-date/m-p/850717#M37276</link>
      <description>&lt;P&gt;SAS dates are counts of days, starting with 1960-01-01 as day zero.&lt;/P&gt;
&lt;P&gt;So you only need to subtract a day from today:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let yesterday = %sysfunc(putn(%sysfunc(today())-1,yymmddn8.));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or you use a DATA step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
call symputx("yesterday",put(today()-1,yymmddn8.));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Dec 2022 06:09:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Filename-should-be-same-as-specified-date/m-p/850717#M37276</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-12-22T06:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: Filename should be same as specified date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Filename-should-be-same-as-specified-date/m-p/850718#M37277</link>
      <description>Sorry to bug you so much, but what will we do if we want to store a date as crazy as 1999-10-24 with the file name while exporting it.</description>
      <pubDate>Thu, 22 Dec 2022 06:18:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Filename-should-be-same-as-specified-date/m-p/850718#M37277</guid>
      <dc:creator>Kirito1</dc:creator>
      <dc:date>2022-12-22T06:18:04Z</dc:date>
    </item>
    <item>
      <title>Re: Filename should be same as specified date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Filename-should-be-same-as-specified-date/m-p/850720#M37279</link>
      <description>&lt;P&gt;From where do you get the date? Is it calculated in code, read from a dataset, or supplied in another way to your code?&lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2022 06:21:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Filename-should-be-same-as-specified-date/m-p/850720#M37279</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-12-22T06:21:23Z</dc:date>
    </item>
    <item>
      <title>Re: Filename should be same as specified date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Filename-should-be-same-as-specified-date/m-p/850721#M37280</link>
      <description>proc import datafile='xyz/IMPORT/TXN_DATA.csv'&lt;BR /&gt;out=CUSTAVG&lt;BR /&gt;DBMS=CSV&lt;BR /&gt;REPLACE;&lt;BR /&gt;run;&lt;BR /&gt;/*Defining yesterday as a function*/&lt;BR /&gt;%let yesterday = %sysfunc(putn(%sysfunc(today())-1,yymmddn8.));&lt;BR /&gt;/*Exporting a file*/&lt;BR /&gt;proc export data=CUSTAVG&lt;BR /&gt;outfile="xyz/Transactions \%sysfunc( yesterday(), date9 ).csv"&lt;BR /&gt;REPLACE&lt;BR /&gt;DBMS=CSV;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;Today() was working but if I use yesterday even after defining a macro Its giving me error.&lt;BR /&gt;Below Code was working fine and giving me desired results.&lt;BR /&gt;proc export data=AVG&lt;BR /&gt;outfile="xyz/Transactions \%sysfunc( today(), date9 ).csv"&lt;BR /&gt;REPLACE&lt;BR /&gt;DBMS=CSV;&lt;BR /&gt;run;</description>
      <pubDate>Thu, 22 Dec 2022 06:26:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Filename-should-be-same-as-specified-date/m-p/850721#M37280</guid>
      <dc:creator>Kirito1</dc:creator>
      <dc:date>2022-12-22T06:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: Filename should be same as specified date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Filename-should-be-same-as-specified-date/m-p/850724#M37281</link>
      <description>Supplied in another way, For example I am working on a task that was supposed to be submitted on so and so date but I am doing it today and want I want that the file name should consist the date when the file was supposed to be worked on.&lt;BR /&gt;Like I export a file with today() it will save file on my system with today's date but I want that file to be saved as 16-09-2022. Then I how could I do that.</description>
      <pubDate>Thu, 22 Dec 2022 06:30:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Filename-should-be-same-as-specified-date/m-p/850724#M37281</guid>
      <dc:creator>Kirito1</dc:creator>
      <dc:date>2022-12-22T06:30:45Z</dc:date>
    </item>
    <item>
      <title>Re: Filename should be same as specified date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Filename-should-be-same-as-specified-date/m-p/850726#M37282</link>
      <description>&lt;P&gt;yesterday is a macro variable, not a data step function.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;outfile="xyz/Transactions \&amp;amp;yesterday..csv"&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Dec 2022 06:39:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Filename-should-be-same-as-specified-date/m-p/850726#M37282</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-12-22T06:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: Filename should be same as specified date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Filename-should-be-same-as-specified-date/m-p/850732#M37286</link>
      <description>&lt;P&gt;Either you have a way to automatically calculate the date, or you need to write it literally into the code anyway.&lt;/P&gt;
&lt;P&gt;I have already shown how to store a calculated date into a macro variable.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2022 06:57:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Filename-should-be-same-as-specified-date/m-p/850732#M37286</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-12-22T06:57:15Z</dc:date>
    </item>
  </channel>
</rss>

