<?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: SAS format date in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/SAS-format-date/m-p/90346#M25800</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Run a proc contents on your data and post the results of that variable. Is it a character or number? What format is applied? What length?&lt;/P&gt;&lt;P&gt;My suggestion would be to convert it to a date in your query using something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;max( input(date, mmddyy10.) ) as max_date &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Jan 2013 21:26:19 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2013-01-29T21:26:19Z</dc:date>
    <item>
      <title>SAS format date</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-format-date/m-p/90343#M25797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am extracting from a table that has our dates formatted as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Date/Time&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When an extraction is done from the database, the date comes over like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;taxid&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; market&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; market_eff_dt&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; market_end_dt&lt;/P&gt;&lt;P&gt;1111&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new england&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 01jan1997&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 31dec9999&lt;/P&gt;&lt;P&gt;1111&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dallas&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 01jan1996&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 31dec9999&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have 30k records and it gives me tons of dupes and what I want when I query is the max of the market_eff_dt yet when I code that it does not work. Even putting in max(market_eff_dt) as market_eff_dt format=date9.,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It will format the date fine but still returns the 2 rows and I know it has something to do with some date thing with SAS where it see's 01jan and says ok that is the max. Just like if I had 01Sep1996 and 01Oct1995, it would return 01Oct because that is the max but it is not because 1996 is later than 1995. I am just not sure how to code it right.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2013 20:37:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-format-date/m-p/90343#M25797</guid>
      <dc:creator>tmm</dc:creator>
      <dc:date>2013-01-29T20:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: SAS format date</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-format-date/m-p/90344#M25798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If it's datetime then you need the format dtdate9., but it should be pulling the appropriate maximum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should show the code if its still not working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That date thing you're talking about is have a date as a character rather than a number. Characters '01' are ordered the same and then you order the next characters, O and S. So Oct will come before September, because O comes before S in the alphabet.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2013 21:05:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-format-date/m-p/90344#M25798</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-01-29T21:05:32Z</dc:date>
    </item>
    <item>
      <title>Re: SAS format date</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-format-date/m-p/90345#M25799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Right, and that is the problem I am running into. It is not the datetime then and doing a max. It is something where I cannot do a max on the date as it shows 01jan1996, 01jan1997. Because 01jan is the max I need to figure something else out so that it looks at 1997 in this case. is there a way to look at the max of a date and just look at the year? that might work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2013 21:22:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-format-date/m-p/90345#M25799</guid>
      <dc:creator>tmm</dc:creator>
      <dc:date>2013-01-29T21:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: SAS format date</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-format-date/m-p/90346#M25800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Run a proc contents on your data and post the results of that variable. Is it a character or number? What format is applied? What length?&lt;/P&gt;&lt;P&gt;My suggestion would be to convert it to a date in your query using something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;max( input(date, mmddyy10.) ) as max_date &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2013 21:26:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-format-date/m-p/90346#M25800</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-01-29T21:26:19Z</dc:date>
    </item>
    <item>
      <title>Re: SAS format date</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-format-date/m-p/90347#M25801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It says it is a number, length is 8, format is date9.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2013 21:45:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-format-date/m-p/90347#M25801</guid>
      <dc:creator>tmm</dc:creator>
      <dc:date>2013-01-29T21:45:11Z</dc:date>
    </item>
    <item>
      <title>Re: SAS format date</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-format-date/m-p/90348#M25802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And what's your query that's not working, can you post the code?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2013 21:50:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-format-date/m-p/90348#M25802</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-01-29T21:50:26Z</dc:date>
    </item>
    <item>
      <title>Re: SAS format date</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-format-date/m-p/90349#M25803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;sure. I have to type it because it is on my work computer and since I work in healthcare have to chng things for HIPAA. hopefully there will be no typos. I don't get an error. the code runs fine, just not taking the max of the date:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(select distinct&lt;/P&gt;&lt;P&gt;mbr_sys_id,&lt;/P&gt;&lt;P&gt;substr(clm_aud_nbr,1,10) as claim,&lt;/P&gt;&lt;P&gt;fst_srvc_dt,&lt;/P&gt;&lt;P&gt;max(mkt_row_eff_dt) as mkt_row_eff_dt format=date9.,&lt;/P&gt;&lt;P&gt;mkt_row_end_dt,&lt;/P&gt;&lt;P&gt;sys_drg_cd&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;from pci.all&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where mkt_row_end_dt &amp;gt;='12/31/9999'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;group by&lt;/P&gt;&lt;P&gt;mbr_sys_id,&lt;/P&gt;&lt;P&gt;clm_aud_nbr,&lt;/P&gt;&lt;P&gt;fst_srvc_dt,&lt;/P&gt;&lt;P&gt;mkt_row_end_dt,&lt;/P&gt;&lt;P&gt;prov_tin,&lt;/P&gt;&lt;P&gt;sys_drg_cd);&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It will not remove the earliest mkt_row_eff_dt. all items are identical except the mkt_row_eff_dt and market name piece&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so like example return is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;mbr_sys_id&amp;nbsp; claim&amp;nbsp;&amp;nbsp;&amp;nbsp; fst_srvc_dt&amp;nbsp;&amp;nbsp; mkt_row_eff_dt&amp;nbsp; mkt_row_end_dt&amp;nbsp;&amp;nbsp; prov_tin&amp;nbsp; sys_drg_cd marketname&lt;/P&gt;&lt;P&gt;111&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 111&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 01jan2011&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 01jan1996&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12319999&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 123&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 270&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; maine&lt;/P&gt;&lt;P&gt;111&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 111&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 01jan2011&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 01jan1997&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12319999&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 123&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 270&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new england&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want the maximum of the mkt row eff dt because I know for a fact this provider tin moved from practicing at the hospital in maine to the hospital in new england therefore I need to say i want the maximum of that effective date so the market names are correct match ups to the provider TINS. I wished we would just put an end date on the mkt_row_end_dt when providers move practices so 01jan1996 the mkt_row_end_dt would be 01jan1997 cuz they started practing at a new place. would make life so much easier but that is not how our claims system is set up and i would love to tell them to chng it but we are the largest insurer in the world and have 60 million members we cover with 104k employees and they are not going to listen to a measly programmer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2013 22:02:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-format-date/m-p/90349#M25803</guid>
      <dc:creator>tmm</dc:creator>
      <dc:date>2013-01-29T22:02:19Z</dc:date>
    </item>
    <item>
      <title>Re: SAS format date</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-format-date/m-p/90350#M25804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is this '12319999' valid date in SAS or is that field character? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyways, select max should work from what I see.&amp;nbsp; But it would be by all your group variables. I'm not 100% sure I understand what you want &lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://communities.sas.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you looking to add&lt;/P&gt;&lt;P&gt;having max(mkt_row_eff_dt)=mkt_row_eff_dt to your where clause. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2013 22:17:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-format-date/m-p/90350#M25804</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-01-29T22:17:47Z</dc:date>
    </item>
    <item>
      <title>Re: SAS format date</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-format-date/m-p/90351#M25805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ah maybe I will try that in my where statement and see if that helps. i will let you know tomm.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2013 23:04:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-format-date/m-p/90351#M25805</guid>
      <dc:creator>tmm</dc:creator>
      <dc:date>2013-01-29T23:04:43Z</dc:date>
    </item>
  </channel>
</rss>

