<?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: How to Split Date Variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-Split-Date-Variable/m-p/300666#M63537</link>
    <description>&lt;P&gt;Then use the YEAR/MONTH/DAY function to extract the relevant components.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See the relevant documentation under Date &amp;amp; Time Category:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/documentation/cdl/en/lefunctionsref/67960/HTML/default/viewer.htm#p0w6napahk6x0an0z2dzozh2ouzm.htm" target="_blank"&gt;https://support.sas.com/documentation/cdl/en/lefunctionsref/67960/HTML/default/viewer.htm#p0w6napahk6x0an0z2dzozh2ouzm.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 25 Sep 2016 23:22:51 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-09-25T23:22:51Z</dc:date>
    <item>
      <title>How to Split Date Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Split-Date-Variable/m-p/300649#M63524</link>
      <description>&lt;P&gt;Given data:&lt;/P&gt;&lt;P&gt;Date &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Company&lt;/P&gt;&lt;P&gt;20150101 &amp;nbsp; Comp1&lt;/P&gt;&lt;P&gt;20150201 &amp;nbsp; Comp2&lt;/P&gt;&lt;P&gt;20140301 &amp;nbsp; Comp3.....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Desired output:&lt;/P&gt;&lt;P&gt;YYYY &amp;nbsp;MM &amp;nbsp;DD &amp;nbsp;Company&lt;/P&gt;&lt;P&gt;2015 &amp;nbsp; 01 &amp;nbsp; &amp;nbsp;01 &amp;nbsp; Comp1&lt;/P&gt;&lt;P&gt;2015 &amp;nbsp; 02 &amp;nbsp; &amp;nbsp;01 &amp;nbsp; Comp2&lt;/P&gt;&lt;P&gt;2014 &amp;nbsp; 03 &amp;nbsp; &amp;nbsp;01 &amp;nbsp; Comp3.....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Its an excel file with 10000 data sets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What code will transform the given data into desired output?&lt;/P&gt;</description>
      <pubDate>Sun, 25 Sep 2016 21:03:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Split-Date-Variable/m-p/300649#M63524</guid>
      <dc:creator>lnukr2</dc:creator>
      <dc:date>2016-09-25T21:03:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to Split Date Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Split-Date-Variable/m-p/300655#M63527</link>
      <description>&lt;P&gt;Do you already know how to get your Excel files into a SAS data set, or is that part of the question?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you want your new fields as numeric or character?&lt;/P&gt;</description>
      <pubDate>Sun, 25 Sep 2016 21:44:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Split-Date-Variable/m-p/300655#M63527</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-09-25T21:44:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to Split Date Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Split-Date-Variable/m-p/300656#M63528</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I know to get excel into sas. I want to know the codes in SAS that can give me the desired output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want a character as well as numeric conversion codes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Sun, 25 Sep 2016 21:49:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Split-Date-Variable/m-p/300656#M63528</guid>
      <dc:creator>lnukr2</dc:creator>
      <dc:date>2016-09-25T21:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to Split Date Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Split-Date-Variable/m-p/300661#M63532</link>
      <description>&lt;P&gt;Whats the type (numeric/character) and format of the variable?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can look at the YEAR/MONTH/DAY function in SAS if your variable is numeric with a date format.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS. &amp;nbsp;Why do you want to convert this? You can use all sorts of aggregation levels if you keep it as a SAS date.&lt;/P&gt;</description>
      <pubDate>Sun, 25 Sep 2016 23:04:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Split-Date-Variable/m-p/300661#M63532</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-09-25T23:04:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to Split Date Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Split-Date-Variable/m-p/300663#M63534</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Date value is numeric.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 25 Sep 2016 23:08:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Split-Date-Variable/m-p/300663#M63534</guid>
      <dc:creator>lnukr2</dc:creator>
      <dc:date>2016-09-25T23:08:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to Split Date Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Split-Date-Variable/m-p/300664#M63535</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Whats the type (numeric/character) &lt;STRONG&gt;&lt;U&gt;and format of the variable?&lt;/U&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 25 Sep 2016 23:16:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Split-Date-Variable/m-p/300664#M63535</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-09-25T23:16:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to Split Date Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Split-Date-Variable/m-p/300665#M63536</link>
      <description>&lt;P&gt;Its numeric date in YYYYMMDD format.&lt;/P&gt;</description>
      <pubDate>Sun, 25 Sep 2016 23:18:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Split-Date-Variable/m-p/300665#M63536</guid>
      <dc:creator>lnukr2</dc:creator>
      <dc:date>2016-09-25T23:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to Split Date Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Split-Date-Variable/m-p/300666#M63537</link>
      <description>&lt;P&gt;Then use the YEAR/MONTH/DAY function to extract the relevant components.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See the relevant documentation under Date &amp;amp; Time Category:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/documentation/cdl/en/lefunctionsref/67960/HTML/default/viewer.htm#p0w6napahk6x0an0z2dzozh2ouzm.htm" target="_blank"&gt;https://support.sas.com/documentation/cdl/en/lefunctionsref/67960/HTML/default/viewer.htm#p0w6napahk6x0an0z2dzozh2ouzm.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 25 Sep 2016 23:22:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Split-Date-Variable/m-p/300666#M63537</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-09-25T23:22:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to Split Date Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Split-Date-Variable/m-p/300673#M63541</link>
      <description>&lt;P&gt;Well, I'm going to go out on a limb, and assume that the number within DATE is actually the 8-digit number that appears in your example (and not a SAS date). &amp;nbsp;In that case:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;length yyyy_c $ 4 mm_c dd_c $ 2;&lt;/P&gt;
&lt;P&gt;date_c = put(date, 8.);&lt;/P&gt;
&lt;P&gt;yyyy_c = date_c;&lt;/P&gt;
&lt;P&gt;mm_c = substr(date_c, 5, 2);&amp;nbsp;&lt;/P&gt;
&lt;P&gt;dd_c = substr(date_c, 7, 2);&lt;/P&gt;
&lt;P&gt;yyyy_n = input(yyyy_c, 4.);&lt;/P&gt;
&lt;P&gt;mm_n = input(mm_c, 2.);&lt;/P&gt;
&lt;P&gt;dd_n = input(dd_c, 2.);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I'm wrong, and you actually have a SAS date stored within DATE, then use the suggestion about date functions.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Sep 2016 02:12:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Split-Date-Variable/m-p/300673#M63541</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-09-26T02:12:27Z</dc:date>
    </item>
  </channel>
</rss>

