<?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 sort the dataset by month order in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-sort-the-dataset-by-month-order/m-p/457503#M115997</link>
    <description>&lt;P&gt;Does your data set contain a variable named MONTH?&amp;nbsp; If so, what's in it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might want to add a similar variable for the YEAR.&amp;nbsp; Probably, you would want December 2017 to sort earlier than January 2018, so&amp;nbsp; you would need both the month and year.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So what do you have already?&lt;/P&gt;</description>
    <pubDate>Wed, 25 Apr 2018 20:13:31 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2018-04-25T20:13:31Z</dc:date>
    <item>
      <title>How to sort the dataset by month order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-sort-the-dataset-by-month-order/m-p/457499#M115995</link>
      <description>&lt;P&gt;How to sort the dataset by month order&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 20:02:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-sort-the-dataset-by-month-order/m-p/457499#M115995</guid>
      <dc:creator>radha009</dc:creator>
      <dc:date>2018-04-25T20:02:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort the dataset by month order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-sort-the-dataset-by-month-order/m-p/457503#M115997</link>
      <description>&lt;P&gt;Does your data set contain a variable named MONTH?&amp;nbsp; If so, what's in it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might want to add a similar variable for the YEAR.&amp;nbsp; Probably, you would want December 2017 to sort earlier than January 2018, so&amp;nbsp; you would need both the month and year.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So what do you have already?&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 20:13:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-sort-the-dataset-by-month-order/m-p/457503#M115997</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-04-25T20:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort the dataset by month order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-sort-the-dataset-by-month-order/m-p/457504#M115998</link>
      <description>&lt;P&gt;Use PROC SQL with ORDER BY clause with MONTH() function.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 20:14:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-sort-the-dataset-by-month-order/m-p/457504#M115998</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-04-25T20:14:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort the dataset by month order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-sort-the-dataset-by-month-order/m-p/457506#M115999</link>
      <description>&lt;P&gt;The answer appears to be convert the month name to a month number and sort that.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;monthnum = month(input('01'||substr(month,1,3)||'1960',date9.));&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 20:16:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-sort-the-dataset-by-month-order/m-p/457506#M115999</guid>
      <dc:creator>HB</dc:creator>
      <dc:date>2018-04-25T20:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort the dataset by month order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-sort-the-dataset-by-month-order/m-p/457519#M116006</link>
      <description>&lt;P&gt;Vague questions = vague generic answers.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 20:41:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-sort-the-dataset-by-month-order/m-p/457519#M116006</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-25T20:41:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort the dataset by month order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-sort-the-dataset-by-month-order/m-p/457575#M116019</link>
      <description>&lt;P&gt;my below data table has month and counts. month data displays dynamically it changes every month. To create SG Plot group graph i am transpose the data. To do transpose by month it gives error as sort the month. once i sorted the month is displaying in alphabetic order and my graph x asis names are displaying in same order. I am expecting the month order should be jan,feb and march&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Month&lt;/TD&gt;&lt;TD&gt;TEST1&lt;/TD&gt;&lt;TD&gt;TEST2&lt;/TD&gt;&lt;TD&gt;TEST3&lt;/TD&gt;&lt;TD&gt;TEST4&lt;/TD&gt;&lt;TD&gt;TEST5&lt;/TD&gt;&lt;TD&gt;TEST6&lt;/TD&gt;&lt;TD&gt;TEST7&lt;/TD&gt;&lt;TD&gt;TEST8&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;January&lt;/TD&gt;&lt;TD&gt;284&lt;/TD&gt;&lt;TD&gt;238&lt;/TD&gt;&lt;TD&gt;421&lt;/TD&gt;&lt;TD&gt;231&lt;/TD&gt;&lt;TD&gt;287&lt;/TD&gt;&lt;TD&gt;217&lt;/TD&gt;&lt;TD&gt;917&lt;/TD&gt;&lt;TD&gt;281&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;February&lt;/TD&gt;&lt;TD&gt;296&lt;/TD&gt;&lt;TD&gt;306&lt;/TD&gt;&lt;TD&gt;556&lt;/TD&gt;&lt;TD&gt;181&lt;/TD&gt;&lt;TD&gt;358&lt;/TD&gt;&lt;TD&gt;250&lt;/TD&gt;&lt;TD&gt;773&lt;/TD&gt;&lt;TD&gt;189&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;March&lt;/TD&gt;&lt;TD&gt;277&lt;/TD&gt;&lt;TD&gt;245&lt;/TD&gt;&lt;TD&gt;568&lt;/TD&gt;&lt;TD&gt;278&lt;/TD&gt;&lt;TD&gt;329&lt;/TD&gt;&lt;TD&gt;227&lt;/TD&gt;&lt;TD&gt;1091&lt;/TD&gt;&lt;TD&gt;229&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data dash.three_Month_Trend2;&lt;BR /&gt;set dash.three_Month_Trend;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;proc sort data=dash.three_Month_Trend2;&lt;BR /&gt;by Month;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;proc transpose data=dash.three_Month_Trend2 out=dash.three_Month_Trend2;&lt;BR /&gt;by month;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; run;&lt;BR /&gt;&lt;BR /&gt;data dash.three_Month_Trend2;&lt;BR /&gt;&amp;nbsp; set dash.three_Month_Trend2 (rename=(col1=count));&lt;BR /&gt;&amp;nbsp; BTO=_LABEL_;&lt;BR /&gt;&amp;nbsp; drop _NAME_ _LABEL_; &amp;nbsp;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 23:28:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-sort-the-dataset-by-month-order/m-p/457575#M116019</guid>
      <dc:creator>radha009</dc:creator>
      <dc:date>2018-04-25T23:28:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort the dataset by month order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-sort-the-dataset-by-month-order/m-p/457578#M116021</link>
      <description>&lt;P&gt;January, February would be sorted&amp;nbsp;alphabetically.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Either convert to numeric, use IF/THEN statements and apply a format or consider using a SAS Date instead of the value 'January'.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it's a SAS date with the MonNAME. format it will still show as January.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 23:43:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-sort-the-dataset-by-month-order/m-p/457578#M116021</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-25T23:43:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort the dataset by month order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-sort-the-dataset-by-month-order/m-p/791077#M253327</link>
      <description>SYNTAX PLEASE..</description>
      <pubDate>Thu, 20 Jan 2022 06:37:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-sort-the-dataset-by-month-order/m-p/791077#M253327</guid>
      <dc:creator>SHIWAGOLLA</dc:creator>
      <dc:date>2022-01-20T06:37:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort the dataset by month order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-sort-the-dataset-by-month-order/m-p/791082#M253329</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/413421"&gt;@SHIWAGOLLA&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;SYNTAX PLEASE..&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Question, please.&lt;/P&gt;
&lt;P&gt;Post your existing data and what you want to get out of it (dataset or report), also show what you already tried (code!).&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jan 2022 07:32:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-sort-the-dataset-by-month-order/m-p/791082#M253329</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-01-20T07:32:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort the dataset by month order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-sort-the-dataset-by-month-order/m-p/791176#M253371</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;you can use proc sql, order by, month() and case when for convert numeric month to char&lt;/P&gt;&lt;P&gt;for example::&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*dataset input;&lt;BR /&gt;%let data_in=SASHELP.CITIDAY;&lt;BR /&gt;*campo date numerico DATE9.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table cityday0 as&lt;BR /&gt;select&lt;BR /&gt;a.date,&lt;BR /&gt;year(a.date) as year_num,&lt;BR /&gt;month(a.date) as month_num,&lt;BR /&gt;(case&lt;BR /&gt;when month(a.date) =01 then 'JAN'&lt;BR /&gt;when month(a.date) =02 then 'FEB'&lt;BR /&gt;when month(a.date) =03 then 'MAR'&lt;BR /&gt;when month(a.date) =04 then 'APR'&lt;BR /&gt;when month(a.date) =05 then 'MAY'&lt;BR /&gt;when month(a.date) =06 then 'JUN'&lt;BR /&gt;when month(a.date) =07 then 'JUL'&lt;BR /&gt;when month(a.date) =08 then 'AUG'&lt;BR /&gt;when month(a.date) =09 then 'SEP'&lt;BR /&gt;when month(a.date) =10 then 'OCT'&lt;BR /&gt;when month(a.date) =11 then 'NOV'&lt;BR /&gt;when month(a.date) =12 then 'DEC'&lt;BR /&gt;else 'None'&lt;BR /&gt;end) as mese_char,&lt;BR /&gt;day(a.date) as day_num&lt;BR /&gt;from &amp;amp;data_in. as a&lt;BR /&gt;order by year_num, month_num, mese_char, day_num;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jan 2022 15:30:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-sort-the-dataset-by-month-order/m-p/791176#M253371</guid>
      <dc:creator>mariangela86</dc:creator>
      <dc:date>2022-01-20T15:30:42Z</dc:date>
    </item>
  </channel>
</rss>

