<?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: Data _null_ and date formatting in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Data-null-and-date-formatting/m-p/175343#M33673</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you heard about date constants? They make date parameters so much easier to handle - they really are worth the effort of the learning.&lt;/P&gt;&lt;P&gt;They allow your code to look much more readable with proper dates rather than a number of days since 1960. Not just more readable but also much better for checking.&lt;/P&gt;&lt;P&gt;They work like:&lt;/P&gt;&lt;P&gt;WHERE dateVariable&amp;nbsp; &amp;lt; "22dec2013"d &lt;/P&gt;&lt;P&gt;So it is really helpful that %SYSFUNC() can so easily provide the formatted dates like&lt;/P&gt;&lt;P&gt;%LET end_lastM = %SYSFUNC( INTNX( month, "&amp;amp;sysdate9"d, -1, E ), date9 ) ;&lt;/P&gt;&lt;P&gt;%LET beg_lastM = %SYSFUNC( INTNX( month, "&amp;amp;end_lastM"d, 0, B ), date9 ) ;&lt;/P&gt;&lt;P&gt;which might be used like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where tran_date between "&amp;amp;beg_lastM"d and "&amp;amp;end_lastM" &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 Dec 2013 22:07:13 GMT</pubDate>
    <dc:creator>Peter_C</dc:creator>
    <dc:date>2013-12-17T22:07:13Z</dc:date>
    <item>
      <title>Data _null_ and date formatting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-null-and-date-formatting/m-p/175341#M33671</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt; data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; null;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; BPM = INTNX(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple;"&gt;'Month'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;,&amp;amp;Rundate,-&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple;"&gt;'b'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;);&amp;nbsp; /*first day last month*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; EPM = INTNX(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple;"&gt;'Month'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;,&amp;amp;Rundate,-&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple;"&gt;'e'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;); /*last day last month*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;CALL&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; SYMPUT(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple;"&gt;'pmb'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;,BPM);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;CALL&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; SYMPUT(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple;"&gt;'pme'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;,EPM);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;%put&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; &amp;amp;pmb &amp;amp;pme ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;The above datastep will return a 5 digit number that represents the dates (ie 19663)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; date1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;last_month_begin=&amp;amp;pmb;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;last_month_end=&amp;amp;pme;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; last_month_begin last_month_end &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal;"&gt;mmddyy10.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;I ran this datastep to convert the results from a number to an actual date format (ie 19663 becomes 11/1/2013)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000; font-size: 14pt;"&gt;&lt;STRONG style="background: white; font-family: 'Courier New';"&gt;Is there a way to avoid this datastep date1 and address the desired date formatting in the data null process instead?&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Dec 2013 14:38:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-null-and-date-formatting/m-p/175341#M33671</guid>
      <dc:creator>Q1983</dc:creator>
      <dc:date>2013-12-17T14:38:57Z</dc:date>
    </item>
    <item>
      <title>Re: Data _null_ and date formatting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-null-and-date-formatting/m-p/175342#M33672</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can avoid using data step at all if you want,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let pmb=%sysfunc(INTNX(Month,&amp;amp;Rundate,-1,b),mmddyy10.);&lt;/P&gt;&lt;P&gt;%let pme=%sysfunc(INTNX(Month,&amp;amp;Rundate,-1,e),mmddyy10.);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Dec 2013 14:54:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-null-and-date-formatting/m-p/175342#M33672</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2013-12-17T14:54:38Z</dc:date>
    </item>
    <item>
      <title>Re: Data _null_ and date formatting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-null-and-date-formatting/m-p/175343#M33673</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you heard about date constants? They make date parameters so much easier to handle - they really are worth the effort of the learning.&lt;/P&gt;&lt;P&gt;They allow your code to look much more readable with proper dates rather than a number of days since 1960. Not just more readable but also much better for checking.&lt;/P&gt;&lt;P&gt;They work like:&lt;/P&gt;&lt;P&gt;WHERE dateVariable&amp;nbsp; &amp;lt; "22dec2013"d &lt;/P&gt;&lt;P&gt;So it is really helpful that %SYSFUNC() can so easily provide the formatted dates like&lt;/P&gt;&lt;P&gt;%LET end_lastM = %SYSFUNC( INTNX( month, "&amp;amp;sysdate9"d, -1, E ), date9 ) ;&lt;/P&gt;&lt;P&gt;%LET beg_lastM = %SYSFUNC( INTNX( month, "&amp;amp;end_lastM"d, 0, B ), date9 ) ;&lt;/P&gt;&lt;P&gt;which might be used like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where tran_date between "&amp;amp;beg_lastM"d and "&amp;amp;end_lastM" &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Dec 2013 22:07:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-null-and-date-formatting/m-p/175343#M33673</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2013-12-17T22:07:13Z</dc:date>
    </item>
  </channel>
</rss>

