<?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: Dates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Dates/m-p/659018#M197448</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/190967"&gt;@Son_Of_Krypton&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC IMPORT OUT= work.PRACTICE1
            DATAFILE= "&amp;amp;file Practice.xlsx"                                         
            DBMS=XLSX REPLACE;
            RUN;

data work.PRACTICE;
set work.PRACTICE1 ;
Date=input(LOAD_DATE,ddmmyy10.);
Date ddmmyy10.;;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thats how i am reading excel file.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If Load_date is not missing and Date is missing then you have invalid data. So set a flag of such.&lt;/P&gt;
&lt;P&gt;I suspect you have not thought through the "email" portion as it sounded like you want one email for each such error. it may be better to do:&lt;/P&gt;
&lt;PRE&gt;data work.PRACTICE;
   set work.PRACTICE1 ;
   Date=input(LOAD_DATE,ddmmyy10.);
   if not missing(load_date) and missing date then DateFlag=1;
   Date ddmmyy10.;
run;

data test;
   set work.practice (where=(Dateflag=1));
run;&lt;/PRE&gt;
&lt;P&gt;if there are any records in Temp then send appropriate information from the data set in an email.&lt;/P&gt;</description>
    <pubDate>Mon, 15 Jun 2020 15:05:54 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-06-15T15:05:54Z</dc:date>
    <item>
      <title>Dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dates/m-p/658559#M197365</link>
      <description>&lt;P&gt;Date&lt;/P&gt;&lt;P&gt;120/04/2020&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;as above example i have wrong date in my dataset and i want code to be fail with invalid date error and mail should be sent as wrong date identified.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2020 06:44:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dates/m-p/658559#M197365</guid>
      <dc:creator>Son_Of_Krypton</dc:creator>
      <dc:date>2020-06-15T06:44:58Z</dc:date>
    </item>
    <item>
      <title>Re: Dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dates/m-p/658560#M197366</link>
      <description>&lt;P&gt;Please post the code in which you want to detect the invalid date string.&lt;/P&gt;
&lt;P&gt;Use the "little running man button" to post the code.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2020 06:49:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dates/m-p/658560#M197366</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-06-15T06:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: Dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dates/m-p/658563#M197368</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  if 0 then set test2 nobs=NOBS;
  if NOBS&amp;gt;1 then do;
    put "Hello";
    put "We have a problem";
    put "Error: Records not matching" NOBS ;
               
   abort abend;
  end;
  stop;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;i want to check for invalid date along with above conditions&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2020 06:56:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dates/m-p/658563#M197368</guid>
      <dc:creator>Son_Of_Krypton</dc:creator>
      <dc:date>2020-06-15T06:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: Dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dates/m-p/658585#M197369</link>
      <description>&lt;P&gt;Since SAS will not even come close to creating such a "date" value I have to assume that your "date" is actually a character string. The question though is whether that value is in a SAS data dataset already or a file you are attempting to read into SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Without details I am going to assume that it is in a SAS data set.&lt;/P&gt;
&lt;P&gt;Attempting to convert that value to a SAS date value would result in a missing a value. Unfortunately we cannot tell from the example whether your good values are supposed to be in day/month/year or month/day/year order.&lt;/P&gt;
&lt;PRE&gt;data want;
   set have;
   dateval = input(date,mmddyy10.);
  /* of if the value should be in day month year order*/
   dateval = input(date,ddmmyy10.);
   format dateval date9.;
run;&lt;/PRE&gt;
&lt;P&gt;This will create missing values of dateval and invalid data messages in the log.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2020 07:10:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dates/m-p/658585#M197369</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-06-15T07:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: Dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dates/m-p/658630#M197371</link>
      <description>&lt;P&gt;i am reading excel file and that date cell in excel file with date value as 120/04/2020 and i have already converted variable to number and applied format ddmmyy10. by this it will take date as dot but i want to identify and put error.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2020 07:25:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dates/m-p/658630#M197371</guid>
      <dc:creator>Son_Of_Krypton</dc:creator>
      <dc:date>2020-06-15T07:25:11Z</dc:date>
    </item>
    <item>
      <title>Re: Dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dates/m-p/658637#M197373</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/190967"&gt;@Son_Of_Krypton&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  if 0 then set test2 nobs=NOBS;
  if NOBS&amp;gt;1 then do;
    put "Hello";
    put "We have a problem";
    put "Error: Records not matching" NOBS ;
               
   abort abend;
  end;
  stop;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;i want to check for invalid date along with above conditions&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;And the string variable possibly containing the invalid date is in dataset test2?&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2020 07:44:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dates/m-p/658637#M197373</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-06-15T07:44:09Z</dc:date>
    </item>
    <item>
      <title>Re: Dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dates/m-p/658911#M197389</link>
      <description>&lt;P&gt;Show exactly how you are reading the Excel file.&lt;/P&gt;
&lt;P&gt;And how you are setting the format.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2020 10:25:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dates/m-p/658911#M197389</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-06-15T10:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: Dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dates/m-p/658927#M197400</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC IMPORT OUT= work.PRACTICE1
            DATAFILE= "&amp;amp;file Practice.xlsx"                                         
            DBMS=XLSX REPLACE;
            RUN;

data work.PRACTICE;
set work.PRACTICE1 ;
Date=input(LOAD_DATE,ddmmyy10.);
Date ddmmyy10.;;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thats how i am reading excel file.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2020 11:34:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dates/m-p/658927#M197400</guid>
      <dc:creator>Son_Of_Krypton</dc:creator>
      <dc:date>2020-06-15T11:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: Dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dates/m-p/658930#M197402</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/190967"&gt;@Son_Of_Krypton&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Date&lt;/P&gt;
&lt;P&gt;120/04/2020&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;as above example i have wrong date in my dataset and i want code to be fail with invalid date error and mail should be sent as wrong date identified.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;There's no such thing as a date that begins with "120/"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If that is a typo, please fix it. If it's not a typo, and you actually have a date that begins with "120/", then that's what you are having problems.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2020 11:41:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dates/m-p/658930#M197402</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-06-15T11:41:59Z</dc:date>
    </item>
    <item>
      <title>Re: Dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dates/m-p/658934#M197406</link>
      <description>Right, but program needs to validate this date and send an error vai email that date is wrong correct it so person who sent me file will fix it from his end</description>
      <pubDate>Mon, 15 Jun 2020 11:50:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dates/m-p/658934#M197406</guid>
      <dc:creator>Son_Of_Krypton</dc:creator>
      <dc:date>2020-06-15T11:50:50Z</dc:date>
    </item>
    <item>
      <title>Re: Dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dates/m-p/658978#M197428</link>
      <description>Right invalid date in test2</description>
      <pubDate>Mon, 15 Jun 2020 13:23:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dates/m-p/658978#M197428</guid>
      <dc:creator>Son_Of_Krypton</dc:creator>
      <dc:date>2020-06-15T13:23:22Z</dc:date>
    </item>
    <item>
      <title>Re: Dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dates/m-p/659018#M197448</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/190967"&gt;@Son_Of_Krypton&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC IMPORT OUT= work.PRACTICE1
            DATAFILE= "&amp;amp;file Practice.xlsx"                                         
            DBMS=XLSX REPLACE;
            RUN;

data work.PRACTICE;
set work.PRACTICE1 ;
Date=input(LOAD_DATE,ddmmyy10.);
Date ddmmyy10.;;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thats how i am reading excel file.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If Load_date is not missing and Date is missing then you have invalid data. So set a flag of such.&lt;/P&gt;
&lt;P&gt;I suspect you have not thought through the "email" portion as it sounded like you want one email for each such error. it may be better to do:&lt;/P&gt;
&lt;PRE&gt;data work.PRACTICE;
   set work.PRACTICE1 ;
   Date=input(LOAD_DATE,ddmmyy10.);
   if not missing(load_date) and missing date then DateFlag=1;
   Date ddmmyy10.;
run;

data test;
   set work.practice (where=(Dateflag=1));
run;&lt;/PRE&gt;
&lt;P&gt;if there are any records in Temp then send appropriate information from the data set in an email.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2020 15:05:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dates/m-p/659018#M197448</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-06-15T15:05:54Z</dc:date>
    </item>
  </channel>
</rss>

