<?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: creating new date field off of another date field in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/creating-new-date-field-off-of-another-date-field/m-p/142328#M37879</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much Hai.Kuo and burntDirt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That worked but the format is 05AUG2012.&amp;nbsp; How can I change that to 05-AUG-12?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you so much.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Jan 2015 16:15:27 GMT</pubDate>
    <dc:creator>jerry898969</dc:creator>
    <dc:date>2015-01-28T16:15:27Z</dc:date>
    <item>
      <title>creating new date field off of another date field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/creating-new-date-field-off-of-another-date-field/m-p/142325#M37876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a date variable called sDate in my data set that is defined as Type=Number Length=8 Format=DATETIME20.&lt;/P&gt;&lt;P&gt;example value is 05AUG2012:00:00:00&lt;/P&gt;&lt;P&gt;I want to use sDate as the basis for creating another variable that displays the sDate as 05-AUG-12&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14224598095933252" jivemacro_uid="_14224598095933252" modifiedtitle="true"&gt;
&lt;P&gt;data temp2 ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; length zDate $9 ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set temp1 ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; zDate = put(sDate, date9.) ;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;run ;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;zDate within my data set is all asterisks. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for any help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 15:44:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/creating-new-date-field-off-of-another-date-field/m-p/142325#M37876</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2015-01-28T15:44:11Z</dc:date>
    </item>
    <item>
      <title>Re: creating new date field off of another date field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/creating-new-date-field-off-of-another-date-field/m-p/142326#M37877</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data temp2 ;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; length zDate $9 ;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; set temp1 ;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; zDate = put(datepart(sDate), date9.) ;&amp;nbsp; &lt;/P&gt;&lt;P&gt;run ;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 15:52:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/creating-new-date-field-off-of-another-date-field/m-p/142326#M37877</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2015-01-28T15:52:08Z</dc:date>
    </item>
    <item>
      <title>Re: creating new date field off of another date field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/creating-new-date-field-off-of-another-date-field/m-p/142327#M37878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sDate is a numeric SAS date time variable, which is the number of seconds since 01 Jan 1960.&lt;/P&gt;&lt;P&gt;You can either convert that to a numeric SAS date variable, which is the number of days since 01 Jan 1960,&lt;/P&gt;&lt;P&gt;or you can convert it to a character date variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Above, you are creating a character date variable, but you are missing the proper date function to extract a date from the date time variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;zDate = put(datepart(sDate),date9.);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will create a character date that you can store or display.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to create a numeric SAS Date variable, you can just do&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;zDate = datepart(sDate);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now it's a numeric SAS Date variable that you can add or subtract.&lt;/P&gt;&lt;P&gt;If you want to display it, you can format it using any of the SAS date formats.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Format zDate date9.;&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>Wed, 28 Jan 2015 15:55:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/creating-new-date-field-off-of-another-date-field/m-p/142327#M37878</guid>
      <dc:creator>BurntDirt</dc:creator>
      <dc:date>2015-01-28T15:55:44Z</dc:date>
    </item>
    <item>
      <title>Re: creating new date field off of another date field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/creating-new-date-field-off-of-another-date-field/m-p/142328#M37879</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much Hai.Kuo and burntDirt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That worked but the format is 05AUG2012.&amp;nbsp; How can I change that to 05-AUG-12?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you so much.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 16:15:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/creating-new-date-field-off-of-another-date-field/m-p/142328#M37879</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2015-01-28T16:15:27Z</dc:date>
    </item>
    <item>
      <title>Re: creating new date field off of another date field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/creating-new-date-field-off-of-another-date-field/m-p/142329#M37880</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;DATE11. instead of DATE9.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 16:21:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/creating-new-date-field-off-of-another-date-field/m-p/142329#M37880</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-01-28T16:21:04Z</dc:date>
    </item>
    <item>
      <title>Re: creating new date field off of another date field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/creating-new-date-field-off-of-another-date-field/m-p/142330#M37881</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;bllardw,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your reply.&amp;nbsp; That almost worked.&amp;nbsp; It now returns 05-AUG-2012.&amp;nbsp; I need the year to only be 2 characters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 17:12:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/creating-new-date-field-off-of-another-date-field/m-p/142330#M37881</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2015-01-28T17:12:52Z</dc:date>
    </item>
    <item>
      <title>Re: creating new date field off of another date field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/creating-new-date-field-off-of-another-date-field/m-p/142331#M37882</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Then you have to make your format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;format&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;picture&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; dttest &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; low-high=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;'%d-%b-%y'&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;datatype&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;=date);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;'01jan2015 00:00:00'dt&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b=put(datepart(a), &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: teal; background: white;"&gt;dttest9.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&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'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 17:45:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/creating-new-date-field-off-of-another-date-field/m-p/142331#M37882</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2015-01-28T17:45:41Z</dc:date>
    </item>
    <item>
      <title>Re: creating new date field off of another date field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/creating-new-date-field-off-of-another-date-field/m-p/142332#M37883</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jerry,&lt;/P&gt;&lt;P&gt;I can't think of a date format that will give you that exactly.&lt;/P&gt;&lt;P&gt;But, if you're making a character SAS date, you can always edit it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try using&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; substr(zDate,8,2) = '';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; zDate = compress(zDate);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are probably a billion more ways to do this, but this was the first that popped in my head.&lt;/P&gt;&lt;P&gt;Gary&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 17:47:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/creating-new-date-field-off-of-another-date-field/m-p/142332#M37883</guid>
      <dc:creator>BurntDirt</dc:creator>
      <dc:date>2015-01-28T17:47:15Z</dc:date>
    </item>
    <item>
      <title>Re: creating new date field off of another date field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/creating-new-date-field-off-of-another-date-field/m-p/142333#M37884</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Slight modification to accommodate years such as 2001 to display as 01 and dates 5 to display as 05&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format;&lt;/P&gt;&lt;P&gt;picture yymonddd &lt;/P&gt;&lt;P&gt;low-high = '%0d-%b-%0y'&lt;/P&gt;&lt;P&gt;(datatype=date);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format date yymonddd.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do date='01Jan2014'd to '31Jan2014'd;&lt;/P&gt;&lt;P&gt;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 17:58:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/creating-new-date-field-off-of-another-date-field/m-p/142333#M37884</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-01-28T17:58:15Z</dc:date>
    </item>
    <item>
      <title>Re: creating new date field off of another date field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/creating-new-date-field-off-of-another-date-field/m-p/142334#M37885</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 18:00:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/creating-new-date-field-off-of-another-date-field/m-p/142334#M37885</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2015-01-28T18:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: creating new date field off of another date field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/creating-new-date-field-off-of-another-date-field/m-p/142335#M37886</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;After having to go through a lot of Y2K issues I prefer to always use 4-digit years and any of my projects has to justify the use of 2-digits. At least with SAS that information is available and it is just how you are choosing to display it. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 18:17:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/creating-new-date-field-off-of-another-date-field/m-p/142335#M37886</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-01-28T18:17:31Z</dc:date>
    </item>
    <item>
      <title>Re: creating new date field off of another date field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/creating-new-date-field-off-of-another-date-field/m-p/142336#M37887</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you everyone for all your help.&amp;nbsp; I spoke with my lead and we are going to keep it with 4 digits for the year.&amp;nbsp;&amp;nbsp; He always says no whenever I ask to change things but this time he agreed it is a better way to go.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 18:38:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/creating-new-date-field-off-of-another-date-field/m-p/142336#M37887</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2015-01-28T18:38:53Z</dc:date>
    </item>
  </channel>
</rss>

