<?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: 'Transform' date in Sas-format in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Transform-date-in-Sas-format/m-p/63638#M18094</link>
    <description>Or if you are reading from an external text file or data lines use the INFORMAT YYMMN6.&lt;BR /&gt;
&lt;BR /&gt;
data test;&lt;BR /&gt;
   informat date yymmn6.;&lt;BR /&gt;
   input date;&lt;BR /&gt;
   format date mmddyy10.;&lt;BR /&gt;
datalines;&lt;BR /&gt;
200405&lt;BR /&gt;
200505&lt;BR /&gt;
200507&lt;BR /&gt;
200610&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
proc print; run;</description>
    <pubDate>Mon, 09 May 2011 22:40:00 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2011-05-09T22:40:00Z</dc:date>
    <item>
      <title>'Transform' date in Sas-format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Transform-date-in-Sas-format/m-p/63636#M18092</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I have dates in the following form: jjjmm (200405, 200602,...). I have 12.000 variables and the dates vary from 199907 - 200612. I was wondering how to 'transform' these dates into the Sas-format, that allows me to calculate with the date? (I want to calculte the average time).&lt;BR /&gt;
&lt;BR /&gt;
I have seen a few examples, but I was wondering how I can do this for all the different dates (and not for one specific date).&lt;BR /&gt;
&lt;BR /&gt;
I hope someone can help me...</description>
      <pubDate>Mon, 09 May 2011 14:57:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Transform-date-in-Sas-format/m-p/63636#M18092</guid>
      <dc:creator>Laura_BE</dc:creator>
      <dc:date>2011-05-09T14:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: 'Transform' date in Sas-format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Transform-date-in-Sas-format/m-p/63637#M18093</link>
      <description>Hello Laura,&lt;BR /&gt;
&lt;BR /&gt;
This is a solution for cases when your date is a numberical variable and character variable:&lt;BR /&gt;
[pre]&lt;BR /&gt;
data i;&lt;BR /&gt;
  YourDate=200405; YourDat="200405"; output;&lt;BR /&gt;
  YourDate=200602; YourDat="200602"; output;&lt;BR /&gt;
run;&lt;BR /&gt;
data r;&lt;BR /&gt;
  set i;&lt;BR /&gt;
  date=MDY(MOD(YourDate,100),01,INT(YourDate/100));&lt;BR /&gt;
  format date date7.; &lt;BR /&gt;
  YD=input(YourDat,6.);&lt;BR /&gt;
  dat=MDY(MOD(YD,100),01,INT(YD/100));&lt;BR /&gt;
  format dat date7.; &lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Sincerely,&lt;BR /&gt;
SPR

Message was edited by: SPR</description>
      <pubDate>Mon, 09 May 2011 15:31:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Transform-date-in-Sas-format/m-p/63637#M18093</guid>
      <dc:creator>SPR</dc:creator>
      <dc:date>2011-05-09T15:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: 'Transform' date in Sas-format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Transform-date-in-Sas-format/m-p/63638#M18094</link>
      <description>Or if you are reading from an external text file or data lines use the INFORMAT YYMMN6.&lt;BR /&gt;
&lt;BR /&gt;
data test;&lt;BR /&gt;
   informat date yymmn6.;&lt;BR /&gt;
   input date;&lt;BR /&gt;
   format date mmddyy10.;&lt;BR /&gt;
datalines;&lt;BR /&gt;
200405&lt;BR /&gt;
200505&lt;BR /&gt;
200507&lt;BR /&gt;
200610&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
proc print; run;</description>
      <pubDate>Mon, 09 May 2011 22:40:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Transform-date-in-Sas-format/m-p/63638#M18094</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2011-05-09T22:40:00Z</dc:date>
    </item>
    <item>
      <title>Re: 'Transform' date in Sas-format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Transform-date-in-Sas-format/m-p/63639#M18095</link>
      <description>Thanks a lot for your help!!</description>
      <pubDate>Tue, 10 May 2011 11:44:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Transform-date-in-Sas-format/m-p/63639#M18095</guid>
      <dc:creator>Laura_BE</dc:creator>
      <dc:date>2011-05-10T11:44:10Z</dc:date>
    </item>
  </channel>
</rss>

