<?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: Date Format in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Date-Format/m-p/7277#M55</link>
    <description>Do you want to create the datetime value to a new variable with just the date portion, or are you only interested in displaying the year/month portion of the datetime?  If the latter, then you'll need to do the picture format as suggested by Christopher.  If the former, then you can do something like:&lt;BR /&gt;
&lt;BR /&gt;
justdate = datepart(dtvar);&lt;BR /&gt;
format justdate yymmn6.;</description>
    <pubDate>Thu, 06 Mar 2008 17:34:29 GMT</pubDate>
    <dc:creator>advoss</dc:creator>
    <dc:date>2008-03-06T17:34:29Z</dc:date>
    <item>
      <title>Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Date-Format/m-p/7274#M52</link>
      <description>I am a new SAS user and was wondering how I would convert a date format that is 7FEB2008HH:MM:SS to 200802. Any help will be great! Thanks.</description>
      <pubDate>Wed, 05 Mar 2008 20:50:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Date-Format/m-p/7274#M52</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-03-05T20:50:59Z</dc:date>
    </item>
    <item>
      <title>Re: Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Date-Format/m-p/7275#M53</link>
      <description>I'm not strong on date formats, but I came up with this suggestion:&lt;BR /&gt;
&lt;BR /&gt;
I didn't see a built-in SAS date format that you could use, so maybe you can create a picture format using&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc format library=work;&lt;BR /&gt;
	picture mydate low-high = '%Y0%m' (datatype=date);&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
If the date is already in SAS as a date formated value (I think you missed a colon after the year), then you could just apply the picture format . . .&lt;BR /&gt;
[pre]&lt;BR /&gt;
data work.date;&lt;BR /&gt;
	format date_in mydate6.;&lt;BR /&gt;
	date_in = '7FEB2008:10:27:59'd;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Then, if the date is literally what you've written, then I would select the date part from this text string and reformat that  to the picture format.&lt;BR /&gt;
[pre]&lt;BR /&gt;
data work.date;&lt;BR /&gt;
	input date_txt $24.;&lt;BR /&gt;
	format date_new mydate6.;&lt;BR /&gt;
	date_new = input(scan(date_txt,1,"H"), date9.);&lt;BR /&gt;
cards;&lt;BR /&gt;
7FEB2008HH:MM:SS&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Wed, 05 Mar 2008 22:03:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Date-Format/m-p/7275#M53</guid>
      <dc:creator>1162</dc:creator>
      <dc:date>2008-03-05T22:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Date-Format/m-p/7276#M54</link>
      <description>I don't think you need to use the picture method.  It looks like yymm7. should work for you (untested)&lt;BR /&gt;
&lt;BR /&gt;
wd</description>
      <pubDate>Thu, 06 Mar 2008 17:28:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Date-Format/m-p/7276#M54</guid>
      <dc:creator>Bill</dc:creator>
      <dc:date>2008-03-06T17:28:44Z</dc:date>
    </item>
    <item>
      <title>Re: Date Format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Date-Format/m-p/7277#M55</link>
      <description>Do you want to create the datetime value to a new variable with just the date portion, or are you only interested in displaying the year/month portion of the datetime?  If the latter, then you'll need to do the picture format as suggested by Christopher.  If the former, then you can do something like:&lt;BR /&gt;
&lt;BR /&gt;
justdate = datepart(dtvar);&lt;BR /&gt;
format justdate yymmn6.;</description>
      <pubDate>Thu, 06 Mar 2008 17:34:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Date-Format/m-p/7277#M55</guid>
      <dc:creator>advoss</dc:creator>
      <dc:date>2008-03-06T17:34:29Z</dc:date>
    </item>
  </channel>
</rss>

