<?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 best way to validate a year, month, day combination in a DATA step? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/best-way-to-validate-a-year-month-day-combination-in-a-DATA-step/m-p/579219#M164396</link>
    <description>&lt;P&gt;Hi Data Step Programmers,&lt;/P&gt;&lt;P&gt;I'm trying to do something which I thought could be solved with a simple function call, but I've searched and searched for a function to do this and have come up empty so far.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 3 numeric variables: year, month and day&lt;/P&gt;&lt;P&gt;I want to determine that they correspond to a valid date, without getting notes such as the below. I need something like MVALID or NVALID, but for a date, not a member name or variable name.&amp;nbsp; Surely this has been solved before!&amp;nbsp; Ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm running SAS 9.4 M3, OS WX64_SV, .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;62 data _null_;&lt;BR /&gt;63 year=2012;&lt;BR /&gt;64 month=2;&lt;BR /&gt;65 day=30;&lt;BR /&gt;66 date=mdy(month,day,year);&lt;BR /&gt;67 date2=input(put(year,4.)||put(month,z2.)||put(day,z2.),yymmdd8.);&lt;BR /&gt;68 put date=date7. date2=date7.;&lt;BR /&gt;69 run;&lt;BR /&gt;&lt;BR /&gt;NOTE: Invalid argument to function MDY(2,30,2012) at line 66 column 7.&lt;BR /&gt;NOTE: Invalid argument to function INPUT at line 67 column 8.&lt;BR /&gt;date=. date2=.&lt;BR /&gt;year=2012 month=2 day=30 date=. date2=. _ERROR_=1 _N_=1&lt;BR /&gt;NOTE: Mathematical operations could not be performed at the following places. The results of the operations have been set to&lt;BR /&gt;missing values.&lt;BR /&gt;Each place is given by: (Number of times) at (Line):(Column).&lt;BR /&gt;1 at 66:7 1 at 67:8&lt;/P&gt;</description>
    <pubDate>Mon, 05 Aug 2019 19:58:16 GMT</pubDate>
    <dc:creator>DDutton</dc:creator>
    <dc:date>2019-08-05T19:58:16Z</dc:date>
    <item>
      <title>best way to validate a year, month, day combination in a DATA step?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/best-way-to-validate-a-year-month-day-combination-in-a-DATA-step/m-p/579219#M164396</link>
      <description>&lt;P&gt;Hi Data Step Programmers,&lt;/P&gt;&lt;P&gt;I'm trying to do something which I thought could be solved with a simple function call, but I've searched and searched for a function to do this and have come up empty so far.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 3 numeric variables: year, month and day&lt;/P&gt;&lt;P&gt;I want to determine that they correspond to a valid date, without getting notes such as the below. I need something like MVALID or NVALID, but for a date, not a member name or variable name.&amp;nbsp; Surely this has been solved before!&amp;nbsp; Ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm running SAS 9.4 M3, OS WX64_SV, .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;62 data _null_;&lt;BR /&gt;63 year=2012;&lt;BR /&gt;64 month=2;&lt;BR /&gt;65 day=30;&lt;BR /&gt;66 date=mdy(month,day,year);&lt;BR /&gt;67 date2=input(put(year,4.)||put(month,z2.)||put(day,z2.),yymmdd8.);&lt;BR /&gt;68 put date=date7. date2=date7.;&lt;BR /&gt;69 run;&lt;BR /&gt;&lt;BR /&gt;NOTE: Invalid argument to function MDY(2,30,2012) at line 66 column 7.&lt;BR /&gt;NOTE: Invalid argument to function INPUT at line 67 column 8.&lt;BR /&gt;date=. date2=.&lt;BR /&gt;year=2012 month=2 day=30 date=. date2=. _ERROR_=1 _N_=1&lt;BR /&gt;NOTE: Mathematical operations could not be performed at the following places. The results of the operations have been set to&lt;BR /&gt;missing values.&lt;BR /&gt;Each place is given by: (Number of times) at (Line):(Column).&lt;BR /&gt;1 at 66:7 1 at 67:8&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2019 19:58:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/best-way-to-validate-a-year-month-day-combination-in-a-DATA-step/m-p/579219#M164396</guid>
      <dc:creator>DDutton</dc:creator>
      <dc:date>2019-08-05T19:58:16Z</dc:date>
    </item>
    <item>
      <title>Re: best way to validate a year, month, day combination in a DATA step?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/best-way-to-validate-a-year-month-day-combination-in-a-DATA-step/m-p/579220#M164397</link>
      <description>&lt;P&gt;Using the DATE2= variation, see if you can suppress messages by adding ?? in the right place:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;date2=input(put(year,4.)||put(month,z2.)||put(day,z2.), ?? yymmdd8.);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Aug 2019 20:04:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/best-way-to-validate-a-year-month-day-combination-in-a-DATA-step/m-p/579220#M164397</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-08-05T20:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: best way to validate a year, month, day combination in a DATA step?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/best-way-to-validate-a-year-month-day-combination-in-a-DATA-step/m-p/579223#M164398</link>
      <description>&lt;P&gt;So embarrassed!&amp;nbsp; I forgot all about the ? and ?? modifiers!&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the quick reminder!&lt;/P&gt;&lt;P&gt;dd&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2019 20:08:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/best-way-to-validate-a-year-month-day-combination-in-a-DATA-step/m-p/579223#M164398</guid>
      <dc:creator>DDutton</dc:creator>
      <dc:date>2019-08-05T20:08:36Z</dc:date>
    </item>
  </channel>
</rss>

