<?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: Split Dataset by Year from mm/dd/yyyy Format in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Split-Dataset-by-Year-from-mm-dd-yyyy-Format/m-p/173032#M44582</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why do you want to split up your datasets? This is a commonly asked question, the answer is usually don't do it.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The manual example, that assumes that your date variable is a SAS numeric variable with a date format, not a character variable:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data Y1998 Y1999;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;if year(date) = 1998 then output Y1998;&lt;/P&gt;&lt;P&gt;else if year(date) = 1999 then output Y1999;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 08 Apr 2014 23:55:54 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2014-04-08T23:55:54Z</dc:date>
    <item>
      <title>Split Dataset by Year from mm/dd/yyyy Format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Split-Dataset-by-Year-from-mm-dd-yyyy-Format/m-p/173031#M44581</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a dataset ("Dataset1") with a date column ("Date").&amp;nbsp; The format is mm/dd/yyyy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to make multiple data files with the information from the rows split up by year.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So it would go from Dataset1 to datasets "1999" and "1998" etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone help me with the code?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Apr 2014 23:07:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Split-Dataset-by-Year-from-mm-dd-yyyy-Format/m-p/173031#M44581</guid>
      <dc:creator>Tegan</dc:creator>
      <dc:date>2014-04-08T23:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: Split Dataset by Year from mm/dd/yyyy Format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Split-Dataset-by-Year-from-mm-dd-yyyy-Format/m-p/173032#M44582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why do you want to split up your datasets? This is a commonly asked question, the answer is usually don't do it.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The manual example, that assumes that your date variable is a SAS numeric variable with a date format, not a character variable:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data Y1998 Y1999;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;if year(date) = 1998 then output Y1998;&lt;/P&gt;&lt;P&gt;else if year(date) = 1999 then output Y1999;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Apr 2014 23:55:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Split-Dataset-by-Year-from-mm-dd-yyyy-Format/m-p/173032#M44582</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-04-08T23:55:54Z</dc:date>
    </item>
    <item>
      <title>Re: Split Dataset by Year from mm/dd/yyyy Format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Split-Dataset-by-Year-from-mm-dd-yyyy-Format/m-p/173033#M44583</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have millions of records spread over 25 datasets which are all by year.&amp;nbsp; So I have 25 yearly datasets containing variables A-Y 1999, A-Y 2000, A-Y 2001...And I have one dataset for Variable Z 1999-2001.&amp;nbsp; I need to split the Variable Z dataset up by year so I can remerge it with Variables A-Y to make A-Z variables for each year in one dataset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does that make sense?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The dataset which has one key and 25 years worth of data was uploaded from a text file.&amp;nbsp; It was a vertical bar delimited file which was just Key (123), Date (01/01/2001), etc. etc...So it didn't specify a format, I think SAS just reads it as a character string, right?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;data Y1998 Y1999; &lt;STRONG&gt;--&amp;gt; This creates output datasets?&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;set have; &lt;STRONG&gt;--&amp;gt;I don't know what a set statement is&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;if year(date) = 1998 then output Y1998; --&amp;gt;&lt;STRONG&gt;So if the variable name is "datevariable" then it would be "if year(datevariable) = 1998 then output Y1998;"?&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;else if year(date) = 1999 then output Y1999; --&amp;gt;&lt;STRONG&gt;And I just add as many of these statements as there are years?&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2014 00:06:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Split-Dataset-by-Year-from-mm-dd-yyyy-Format/m-p/173033#M44583</guid>
      <dc:creator>Tegan</dc:creator>
      <dc:date>2014-04-09T00:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: Split Dataset by Year from mm/dd/yyyy Format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Split-Dataset-by-Year-from-mm-dd-yyyy-Format/m-p/173034#M44584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why not merge it directly? 1 million records isn't that big of a dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;If you're not familiar with SAS at all, you may want to view these videos/tutorials. Or are you using SAS Enterprise Guide?&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.ats.ucla.edu/stat/sas/sk/default.htm" title="http://www.ats.ucla.edu/stat/sas/sk/default.htm"&gt;SAS Starter Kit&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2014 01:10:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Split-Dataset-by-Year-from-mm-dd-yyyy-Format/m-p/173034#M44584</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-04-09T01:10:06Z</dc:date>
    </item>
  </channel>
</rss>

