<?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: Converting a datetime variable into two other date formats in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Converting-a-datetime-variable-into-two-other-date-formats/m-p/106494#M1204</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;%let extract_dttm=31OCT12:23:59:59;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let period_dt=%sysfunc(inputn(&amp;amp;extract_dttm,datetime.),dtdate9.);&lt;/P&gt;&lt;P&gt;%put period_dt=&amp;amp;period_dt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let period_yyyymm=%sysfunc(inputn(&amp;amp;period_dt,date9.),yymmn6.);&lt;BR /&gt;%put period_yyyymmt=&amp;amp;period_yyyymm;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 25 Oct 2012 12:08:53 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2012-10-25T12:08:53Z</dc:date>
    <item>
      <title>Converting a datetime variable into two other date formats</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Converting-a-datetime-variable-into-two-other-date-formats/m-p/106491#M1201</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a datetime macrovariable called &amp;amp;extract_dttm, which has the value 31OCT12:23:59:59. Based on this, I need to create two additional macrovariables:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;amp;period_dt, which should get the value 31OCT2012.&lt;/P&gt;&lt;P&gt;&amp;amp;period_yyyymm, which should get the value 201210.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone please advise me on how to accomplish this in the precode of an Extract transformation?&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>Thu, 25 Oct 2012 11:35:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Converting-a-datetime-variable-into-two-other-date-formats/m-p/106491#M1201</guid>
      <dc:creator>TurnTheBacon</dc:creator>
      <dc:date>2012-10-25T11:35:13Z</dc:date>
    </item>
    <item>
      <title>Re: Converting a datetime variable into two other date formats</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Converting-a-datetime-variable-into-two-other-date-formats/m-p/106492#M1202</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;24&amp;nbsp;&amp;nbsp; %let d=31OCT12:23:59:59;&lt;/P&gt;&lt;P&gt;25&amp;nbsp;&amp;nbsp; %let dd=%sysfunc(putn(%sysfunc(datepart("&amp;amp;d"dt)),date9));&lt;/P&gt;&lt;P&gt;26&amp;nbsp;&amp;nbsp; %put &amp;amp;dd;&lt;/P&gt;&lt;P&gt;31OCT2012&lt;/P&gt;&lt;P&gt;27&amp;nbsp;&amp;nbsp; %let ddd=%sysfunc(putn("&amp;amp;dd"d,yymmn6.));&lt;/P&gt;&lt;P&gt;28&amp;nbsp;&amp;nbsp; %put &amp;amp;ddd;&lt;/P&gt;&lt;P&gt;201210&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Oct 2012 12:03:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Converting-a-datetime-variable-into-two-other-date-formats/m-p/106492#M1202</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-10-25T12:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: Converting a datetime variable into two other date formats</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Converting-a-datetime-variable-into-two-other-date-formats/m-p/106493#M1203</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%let x=31OCT2012:23:59:59 ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%let y=%sysfunc(putn("&amp;amp;x"dt,dtdate9.));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%let z=%sysfunc(putn("&amp;amp;y"d,yymmddn8.),$6.);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;x=31OCT2012:23:59:59&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;y=31OCT2012&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;z=201210&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Oct 2012 12:07:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Converting-a-datetime-variable-into-two-other-date-formats/m-p/106493#M1203</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-10-25T12:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: Converting a datetime variable into two other date formats</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Converting-a-datetime-variable-into-two-other-date-formats/m-p/106494#M1204</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;%let extract_dttm=31OCT12:23:59:59;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let period_dt=%sysfunc(inputn(&amp;amp;extract_dttm,datetime.),dtdate9.);&lt;/P&gt;&lt;P&gt;%put period_dt=&amp;amp;period_dt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let period_yyyymm=%sysfunc(inputn(&amp;amp;period_dt,date9.),yymmn6.);&lt;BR /&gt;%put period_yyyymmt=&amp;amp;period_yyyymm;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Oct 2012 12:08:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Converting-a-datetime-variable-into-two-other-date-formats/m-p/106494#M1204</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2012-10-25T12:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: Converting a datetime variable into two other date formats</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Converting-a-datetime-variable-into-two-other-date-formats/m-p/106495#M1205</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First create extract_dttm as a SAS datetime value.&amp;nbsp; Then you can write the value in any format with out having to do the conversion everything you need it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV style="font-family: Courier New; font-size: 11pt;"&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; extract_dttm = 31OCT12:23:59:59;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; dt=&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%sysevalF&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;("&amp;amp;extract_dttm"dt);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; period_dt = &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;(putn(&amp;amp;dt,dtdate,9));&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; period_yyyymm =&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;(datepart(&amp;amp;dt),yymmn6);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Oct 2012 12:26:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Converting-a-datetime-variable-into-two-other-date-formats/m-p/106495#M1205</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2012-10-25T12:26:07Z</dc:date>
    </item>
  </channel>
</rss>

