<?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: Oh these lovely dates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Oh-these-lovely-dates/m-p/316244#M69081</link>
    <description>&lt;P&gt;For my 2ps worth:&lt;/P&gt;
&lt;P&gt;- Don't put data in filenames. &amp;nbsp;All you are doing is making various things much harder - programming you know how to mess around fing filenames, version control will not work as filename keeps changing etc. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;- Don't use macro - which is a text generation tool - to do processing on what is numeric data. &amp;nbsp;Macro has its place, manipulating data is not it. &amp;nbsp;That is what Base SAS is for. &amp;nbsp;Of course, if you follow point 1 above then you don't have this issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For instance your where could be:&lt;/P&gt;
&lt;PRE&gt;where LoadDate = today();&lt;/PRE&gt;
&lt;P&gt;Assuming loaddate is a date variable.&lt;/P&gt;</description>
    <pubDate>Fri, 02 Dec 2016 13:04:04 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2016-12-02T13:04:04Z</dc:date>
    <item>
      <title>Oh these lovely dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Oh-these-lovely-dates/m-p/316235#M69076</link>
      <description>&lt;P&gt;I am having a field day with dates today.&lt;/P&gt;
&lt;P&gt;Has anyone managed to do this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We load a daily dataset.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My manager insists we use ISO8601 format, but SAS has no inclination to honour ISO standards.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We put postfix on datasets as _yyyymmdd and declare such dates as Macro variables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Only when you try to read such a date into a dataset with a Where clause we get terrible problems:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%let dtToday = %sysfunc(date(),yymmddn8.);

Testfile is specified as 
Data TestFile;
Length FileName $30.;
/*===We use a Tab as a delimiter===*/
Infile Datalines dlm='09'x;
Input LoadDate Date9. FileName $ VerNo 2.;
FORMAT LoadDate Date9. FileName $30.;
Datalines;
30NOV2016 20161130_1.zip 1
01DEC2016 20161201_2.zip 2
02DEC2016 20161202_3.zip 3
05DEC2016 20161205_4.zip 4
06DEC2016 20161206_5.zip 5
;
Run;

Data test;
SET TestFile;
where LoadDate = inputn(&amp;amp;dtToday,yymmddn8.);
/*where LoadDate = inputn(&amp;amp;dtToday,Date9.);
where LoadDate = inputn(&amp;amp;dtToday,yymmdd10.);
where LoadDate = "&amp;amp;dtToday"d;*/
/*where LoadDate = &amp;amp;dtToday;*/
run;&lt;/PRE&gt;
&lt;P&gt;SYMBOLGEN: Macro variable DTTODAY resolves to 20161202&lt;BR /&gt;32 where LoadDate = inputn(&amp;amp;dtToday,yymmddn8.);&lt;BR /&gt; _________&lt;BR /&gt; 22&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant, &lt;BR /&gt; a missing value, (, ), +, ',', -, INPUT, NOT, PUT, ^, ~.&lt;/P&gt;
&lt;P&gt;32 where LoadDate = inputn(&amp;amp;dtToday,yymmddn8.);&lt;BR /&gt; _________&lt;BR /&gt; 201&lt;BR /&gt;ERROR 201-322: The option is not recognized and will be ignored.&lt;/P&gt;
&lt;P&gt;ERROR: Syntax error while parsing WHERE clause.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How do I get around this?&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2016 12:44:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Oh-these-lovely-dates/m-p/316235#M69076</guid>
      <dc:creator>Lenvdb</dc:creator>
      <dc:date>2016-12-02T12:44:02Z</dc:date>
    </item>
    <item>
      <title>Re: Oh these lovely dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Oh-these-lovely-dates/m-p/316237#M69077</link>
      <description>&lt;P&gt;Since input() reads from a string, use double quotes:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where LoadDate = inputn("&amp;amp;dtToday",yymmddn8.);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Dec 2016 12:49:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Oh-these-lovely-dates/m-p/316237#M69077</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-12-02T12:49:43Z</dc:date>
    </item>
    <item>
      <title>Re: Oh these lovely dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Oh-these-lovely-dates/m-p/316238#M69078</link>
      <description>&lt;P&gt;And SAS has the &lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a003169814.htm" target="_blank"&gt;e8601* formats for ISO 8601 values&lt;/A&gt; since version 9.2.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2016 12:51:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Oh-these-lovely-dates/m-p/316238#M69078</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-12-02T12:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: Oh these lovely dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Oh-these-lovely-dates/m-p/316239#M69079</link>
      <description>&lt;P&gt;Date literals are specified in a DATE9 format, or strip the format entirely, or convert in WHERE clause&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where Loaddate = input("&amp;amp;dttoday.", yymmdd10.);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let dtToday = %sysfunc(today());&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where loadDate = &amp;amp;dtToday;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2016 12:54:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Oh-these-lovely-dates/m-p/316239#M69079</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-02T12:54:28Z</dc:date>
    </item>
    <item>
      <title>Re: Oh these lovely dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Oh-these-lovely-dates/m-p/316241#M69080</link>
      <description>Nope - no success:&lt;BR /&gt;SYMBOLGEN:  Macro variable DTTODAY resolves to 20161202&lt;BR /&gt;33         where LoadDate = inputn("&amp;amp;dtToday",yymmddn8.);&lt;BR /&gt;                                              _________&lt;BR /&gt;                                              22&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant, &lt;BR /&gt;              a missing value, (, ), +, ',', -, INPUT, NOT, PUT, ^, ~.  &lt;BR /&gt;&lt;BR /&gt;33         where LoadDate = inputn("&amp;amp;dtToday",yymmddn8.);&lt;BR /&gt;                                              _________&lt;BR /&gt;                                              201&lt;BR /&gt;ERROR 201-322: The option is not recognized and will be ignored.</description>
      <pubDate>Fri, 02 Dec 2016 13:01:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Oh-these-lovely-dates/m-p/316241#M69080</guid>
      <dc:creator>Lenvdb</dc:creator>
      <dc:date>2016-12-02T13:01:11Z</dc:date>
    </item>
    <item>
      <title>Re: Oh these lovely dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Oh-these-lovely-dates/m-p/316244#M69081</link>
      <description>&lt;P&gt;For my 2ps worth:&lt;/P&gt;
&lt;P&gt;- Don't put data in filenames. &amp;nbsp;All you are doing is making various things much harder - programming you know how to mess around fing filenames, version control will not work as filename keeps changing etc. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;- Don't use macro - which is a text generation tool - to do processing on what is numeric data. &amp;nbsp;Macro has its place, manipulating data is not it. &amp;nbsp;That is what Base SAS is for. &amp;nbsp;Of course, if you follow point 1 above then you don't have this issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For instance your where could be:&lt;/P&gt;
&lt;PRE&gt;where LoadDate = today();&lt;/PRE&gt;
&lt;P&gt;Assuming loaddate is a date variable.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2016 13:04:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Oh-these-lovely-dates/m-p/316244#M69081</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-12-02T13:04:04Z</dc:date>
    </item>
    <item>
      <title>Re: Oh these lovely dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Oh-these-lovely-dates/m-p/316245#M69082</link>
      <description>&lt;P&gt;Thank you so much Reeza&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;where Loaddate = input("&amp;amp;dttoday.", yymmdd10.);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This worked perfectly...&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Now I need a drink....&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Pref a strong one!&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://communities.sas.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2016 13:05:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Oh-these-lovely-dates/m-p/316245#M69082</guid>
      <dc:creator>Lenvdb</dc:creator>
      <dc:date>2016-12-02T13:05:39Z</dc:date>
    </item>
  </channel>
</rss>

