<?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 DATES in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/SAS-DATES/m-p/125260#M34422</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Sir,&lt;/P&gt;&lt;P&gt;Its so worthful information to me.I appreciate your time and help&lt;/P&gt;&lt;P&gt;I noted the points you mentioned and where i went wrong&lt;/P&gt;&lt;P&gt;Now it works perfect except that the datevar contains days and we have to use another format to convert to the actual dates???&lt;/P&gt;&lt;P&gt;Thanks again&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;datevar = input(put(date,8.), yymmdd8.);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;format datevar &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt; font-family: Courier New;"&gt;yymmdd8.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style=": ; font-size: 10pt; font-family: Courier New;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 30 Aug 2013 14:22:16 GMT</pubDate>
    <dc:creator>robertrao</dc:creator>
    <dc:date>2013-08-30T14:22:16Z</dc:date>
    <item>
      <title>SAS DATES</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-DATES/m-p/125252#M34414</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a date variable which contains dates in this format&lt;/P&gt;&lt;P&gt;20111122&lt;/P&gt;&lt;P&gt;20120109&lt;/P&gt;&lt;P&gt;20111020&lt;/P&gt;&lt;P&gt;How can i change to meaningful SAS dates???&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Aug 2013 13:21:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-DATES/m-p/125252#M34414</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2013-08-29T13:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: SAS DATES</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-DATES/m-p/125253#M34415</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data temp;&lt;/P&gt;&lt;P&gt;input var1 $;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;20111122&lt;/P&gt;&lt;P&gt;20120109&lt;/P&gt;&lt;P&gt;20111020&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data temp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set temp;&lt;/P&gt;&lt;P&gt;datevar=input(var1,yymmdd10.);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Aug 2013 13:49:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-DATES/m-p/125253#M34415</guid>
      <dc:creator>AskoLötjönen</dc:creator>
      <dc:date>2013-08-29T13:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: SAS DATES</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-DATES/m-p/125254#M34416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can do this in one step by reading the data with an informat:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="SASdateinformat.jpg" class="jive-image" src="https://communities.sas.com/legacyfs/online/4106_SASdateinformat.jpg" /&gt;&lt;/P&gt;&lt;P&gt;(You didn't say how your data actually look and how you specify an informat is a little different depending on whether you are using list input or column/formatted input.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;liz&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Aug 2013 14:25:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-DATES/m-p/125254#M34416</guid>
      <dc:creator>Liz_LSU</dc:creator>
      <dc:date>2013-08-29T14:25:19Z</dc:date>
    </item>
    <item>
      <title>Re: SAS DATES</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-DATES/m-p/125255#M34417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;then you can add a FORMAT to the above data step to show date however you want; for example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data temp;&lt;/P&gt;&lt;P&gt;input mydate :yymmdd8.;&lt;/P&gt;&lt;P&gt;format mydate mmddyy10.;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;20111122&lt;/P&gt;&lt;P&gt;20120109&lt;/P&gt;&lt;P&gt;20111020&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Aug 2013 16:02:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-DATES/m-p/125255#M34417</guid>
      <dc:creator>Altal</dc:creator>
      <dc:date>2013-08-29T16:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: SAS DATES</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-DATES/m-p/125256#M34418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I tried this and it gives me negative numbers!!!!&lt;/P&gt;&lt;P&gt;Could you help me find the error???&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input date;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;20111122&lt;/P&gt;&lt;P&gt;20120109&lt;/P&gt;&lt;P&gt;20111020&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;datevar=input(date,yymmdd10.);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Aug 2013 13:36:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-DATES/m-p/125256#M34418</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2013-08-30T13:36:59Z</dc:date>
    </item>
    <item>
      <title>Re: SAS DATES</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-DATES/m-p/125257#M34419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Robert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are your dates before January 1, 1960? In SAS, day 0 is January 1, 1960, so any date earlier than that will be a negative number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use Altal's suggest to format your date variable as a date and you should see it printing as the correct date. Look at it without the format first, then with the format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BTW, you can do this in one step, you don't have to use two! (I teach a SAS programming class and one of my pet peeves is using umpteen steps when one will do.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;liz&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Aug 2013 13:40:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-DATES/m-p/125257#M34419</guid>
      <dc:creator>Liz_LSU</dc:creator>
      <dc:date>2013-08-30T13:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: SAS DATES</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-DATES/m-p/125258#M34420</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Liz,&lt;/P&gt;&lt;P&gt;Thanks for the reply. My dates are not prior 1960&lt;/P&gt;&lt;P&gt;I have those dates in a sas dataset and i am setting the dataset and creating several conditions and in the process i want to also change the format&lt;/P&gt;&lt;P&gt;It doesnot work for me!!!!&lt;/P&gt;&lt;P&gt;It stays the same even after i write&lt;/P&gt;&lt;P&gt;format var yymmdd10.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Aug 2013 13:51:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-DATES/m-p/125258#M34420</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2013-08-30T13:51:04Z</dc:date>
    </item>
    <item>
      <title>Re: SAS DATES</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-DATES/m-p/125259#M34421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your error is caused by two factors.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Failing to read the documentation on the INPUT function, and thus failing to realize that it expects a character string as input not a numeric value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Ignoring the message in the log about numeric to character conversion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the incoming value is numeric, the INPUT function performs the numeric-to-character conversion using a 12-character string.&amp;nbsp; Thus the INPUT function reads four blanks, followed by six digits.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can correct the problem in two ways.&amp;nbsp; You could read DATE as character in the original INPUT statement.&amp;nbsp; Or, if you leave DATE as numeric, you could control the numeric-to-character conversion:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;datevar = input(put(date,8.), yymmdd8.);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While you could stick with the yymmdd10. informat, it shows that you are paying attention when you use an 8-character informat (instead of a 10-character informat) to read 8 characters.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Aug 2013 14:08:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-DATES/m-p/125259#M34421</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2013-08-30T14:08:10Z</dc:date>
    </item>
    <item>
      <title>Re: SAS DATES</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-DATES/m-p/125260#M34422</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Sir,&lt;/P&gt;&lt;P&gt;Its so worthful information to me.I appreciate your time and help&lt;/P&gt;&lt;P&gt;I noted the points you mentioned and where i went wrong&lt;/P&gt;&lt;P&gt;Now it works perfect except that the datevar contains days and we have to use another format to convert to the actual dates???&lt;/P&gt;&lt;P&gt;Thanks again&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;datevar = input(put(date,8.), yymmdd8.);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;format datevar &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt; font-family: Courier New;"&gt;yymmdd8.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style=": ; font-size: 10pt; font-family: Courier New;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Aug 2013 14:22:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-DATES/m-p/125260#M34422</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2013-08-30T14:22:16Z</dc:date>
    </item>
    <item>
      <title>Re: SAS DATES</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-DATES/m-p/125261#M34423</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's correct.&amp;nbsp; DATEVAR is stored on SAS's date scale where 0 = January 1, 1960.&amp;nbsp; The good news is that you can use any date format that you please to express DATEVAR.&amp;nbsp; Any of these (and more) would be possible:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;format datevar yymmdd8.;&lt;/P&gt;&lt;P&gt;format datevar yymmdd10.;&lt;/P&gt;&lt;P&gt;format datevar mmddyy10.;&lt;/P&gt;&lt;P&gt;formate datevar date9.;&lt;/P&gt;&lt;P&gt;format datevar worddate18.;&lt;/P&gt;&lt;P&gt;format datevar monyy5.;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Aug 2013 14:27:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-DATES/m-p/125261#M34423</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2013-08-30T14:27:46Z</dc:date>
    </item>
  </channel>
</rss>

