<?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: Need to sort the values as per the highest value in col5 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Need-to-sort-the-values-as-per-the-highest-value-in-col5/m-p/677066#M204196</link>
    <description>&lt;P&gt;Add some variables to make it possible.&amp;nbsp; Looks like you need to add a variable to group the types of records and then something to indicate which one is a subgroup.&amp;nbsp; And if you want to sort the groups by the group total then that also needs to be another variable.&amp;nbsp; So if you data looks like this and is in some unwanted order:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
  infile cards dsd dlm='|' truncover ;
  input grp subgrp Label :$30. Mild Moderate Severe Total ;
  if subgrp=1 then grandtotal=total;
  retain grandtotal;
cards;
1|1|Number of subjects dosed| | | |6
2|1|Number of subjects with an Event|2|1|0|3
4|1|NervousSystem Disorders|2|0|0|2
4|2|Headache|1|0|0|1
4|2|Parasthesia|1|0|0|1
5|1|Gastrointestinal disorders|1|0|0|1
5|2|Vomiting|1|0|0|1
7|1|General Disorder|1|0|0|1
7|2|Chills|1|0|0|1
3|1|Injury,poisoning and other|1|1|0|1
3|2|other|1|1|0|1
6|1|Prodeduralheadache|1|1|0|1
6|2|prodeduralpain|1|0|0|1
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can now sort it to print in the order you want.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=have ;
  by  descending grandtotal grp subgrp descending total;
run;
proc print noobs;
 var label  Mild Moderate Severe Total ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Label                             Mild    Moderate    Severe    Total

Number of subjects dosed            .         .          .        6
Number of subjects with an Eve      2         1          0        3
NervousSystem Disorders             2         0          0        2
Headache                            1         0          0        1
Parasthesia                         1         0          0        1
Injury,poisoning and other          1         1          0        1
other                               1         1          0        1
Gastrointestinal disorders          1         0          0        1
Vomiting                            1         0          0        1
Prodeduralheadache                  1         1          0        1
prodeduralpain                      1         0          0        1
General Disorder                    1         0          0        1
Chills                              1         0          0        1&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 16 Aug 2020 14:15:39 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2020-08-16T14:15:39Z</dc:date>
    <item>
      <title>Need to sort the values as per the highest value in col5</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-sort-the-values-as-per-the-highest-value-in-col5/m-p/676981#M204160</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;&lt;P&gt;I need to sort the attached data set (attached a data set image) as per the values (Col5)&lt;/P&gt;&lt;P&gt;Actually the sorting needs to be started from ord3. ord 1 and 2 should be as it is.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The requirement is the Ord10 respective&amp;nbsp; col5 value is 2 So the sorting should be , instead of ord3 and 4. it should be ord 10-12. (ord 11 and 12 is the sub category of ord10)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also if the col5 values all are equal then it should sort the alphabetic wise&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="the dataset image" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/48271iB523B755648566DC/image-size/large?v=v2&amp;amp;px=999" role="button" title="20200815_203541.jpg" alt="the dataset image" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;the dataset image&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Aug 2020 15:33:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-sort-the-values-as-per-the-highest-value-in-col5/m-p/676981#M204160</guid>
      <dc:creator>ambadi007</dc:creator>
      <dc:date>2020-08-15T15:33:31Z</dc:date>
    </item>
    <item>
      <title>Re: Need to sort the values as per the highest value in col5</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-sort-the-values-as-per-the-highest-value-in-col5/m-p/676983#M204161</link>
      <description>&lt;P&gt;Your post is very unclear.&lt;/P&gt;
&lt;P&gt;Please supply data in usable form (NO PICTURES, data steps with datalines), and what you expect as result.&lt;/P&gt;</description>
      <pubDate>Sat, 15 Aug 2020 16:16:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-sort-the-values-as-per-the-highest-value-in-col5/m-p/676983#M204161</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-08-15T16:16:58Z</dc:date>
    </item>
    <item>
      <title>Re: Need to sort the values as per the highest value in col5</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-sort-the-values-as-per-the-highest-value-in-col5/m-p/677024#M204175</link>
      <description>&lt;P&gt;I have a data set as below&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ord&lt;/TD&gt;&lt;TD&gt;Label&lt;/TD&gt;&lt;TD&gt;Mild&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Moderate&lt;/TD&gt;&lt;TD&gt;Severe&lt;/TD&gt;&lt;TD&gt;Total&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Number of subjects dosed&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;Number of subjects with an Event&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;Gastrointestinal disorders&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;Vomiting&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;General Disorder&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;Chills&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;Innjury,poisoning and other&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;Prodeduralheadache&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;TD&gt;prodeduralpain&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;NervousSystem Disorders&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11&lt;/TD&gt;&lt;TD&gt;Headache&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;TD&gt;Parasthesia&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Here in the column label colored in Red is the heading for the different diseases and down for that is names .&lt;/P&gt;&lt;P&gt;I need to sort the data set in such a way that the label &lt;FONT color="#FF0000"&gt;NervousSystem Disorders&lt;/FONT&gt;&lt;FONT color="#FF0000"&gt;disorder &lt;FONT color="#000000"&gt;total is 2 , so it should come above in the dseas names. so after the ord2&amp;nbsp;NervousSystem Disorders and the particular names should come...Below is the sample dataset which i need&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#000000"&gt;for better understanding i have marked the changed values in &lt;FONT color="#99CC00"&gt;green&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ord&lt;/TD&gt;&lt;TD&gt;Label&lt;/TD&gt;&lt;TD&gt;Mild&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Moderate&lt;/TD&gt;&lt;TD&gt;Severe&lt;/TD&gt;&lt;TD&gt;Total&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Number of subjects dosed&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;Number of subjects with an Event&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#99CC00"&gt;3&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#99CC00"&gt;NervousSystem Disorders&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#99CC00"&gt;2&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#99CC00"&gt;0&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#99CC00"&gt;0&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#99CC00"&gt;2&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#99CC00"&gt;Headache&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#99CC00"&gt;1&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#99CC00"&gt;0&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#99CC00"&gt;0&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#99CC00"&gt;1&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#99CC00"&gt;Parasthesia&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#99CC00"&gt;1&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#99CC00"&gt;0&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#99CC00"&gt;0&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#99CC00"&gt;1&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;Gastrointestinal disorders&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;Vomiting&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;General Disorder&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;TD&gt;Chills&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;Innjury,poisoning and other&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11&lt;/TD&gt;&lt;TD&gt;Prodeduralheadache&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;TD&gt;prodeduralpain&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Aug 2020 04:02:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-sort-the-values-as-per-the-highest-value-in-col5/m-p/677024#M204175</guid>
      <dc:creator>ambadi007</dc:creator>
      <dc:date>2020-08-16T04:02:01Z</dc:date>
    </item>
    <item>
      <title>Re: Need to sort the values as per the highest value in col5</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-sort-the-values-as-per-the-highest-value-in-col5/m-p/677025#M204176</link>
      <description>&lt;P&gt;Sort your dataset&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;by descending total;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;That will move the entry with a value of 2 up into 3rd position.&lt;/P&gt;
&lt;P&gt;But I see no implementable functional rule for the other two you want to move up.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What you are talking about are NOT&amp;nbsp;&lt;EM&gt;labels&lt;/EM&gt;, they are&amp;nbsp;&lt;EM&gt;values&lt;/EM&gt;.&amp;nbsp;&lt;EM&gt;Label&lt;/EM&gt;&amp;nbsp;has a completely different meaning in a SAS context. See&amp;nbsp;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lestmtsref&amp;amp;docsetTarget=n1r8ub0jx34xfsn1ppcjfe0u16pc.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;here&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Aug 2020 05:37:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-sort-the-values-as-per-the-highest-value-in-col5/m-p/677025#M204176</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-08-16T05:37:48Z</dc:date>
    </item>
    <item>
      <title>Re: Need to sort the values as per the highest value in col5</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-sort-the-values-as-per-the-highest-value-in-col5/m-p/677032#M204179</link>
      <description>I have tried already with descending total, but it works only with that particular record, i need to move up the other 2 sub category also with this.. is there any way to create a new sort variable to sort this in such a way</description>
      <pubDate>Sun, 16 Aug 2020 06:37:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-sort-the-values-as-per-the-highest-value-in-col5/m-p/677032#M204179</guid>
      <dc:creator>ambadi007</dc:creator>
      <dc:date>2020-08-16T06:37:56Z</dc:date>
    </item>
    <item>
      <title>Re: Need to sort the values as per the highest value in col5</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-sort-the-values-as-per-the-highest-value-in-col5/m-p/677036#M204182</link>
      <description>&lt;P&gt;I see nothing in your data that identifies those two observations as sub-categories to the other.&lt;/P&gt;</description>
      <pubDate>Sun, 16 Aug 2020 07:36:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-sort-the-values-as-per-the-highest-value-in-col5/m-p/677036#M204182</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-08-16T07:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: Need to sort the values as per the highest value in col5</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-sort-the-values-as-per-the-highest-value-in-col5/m-p/677066#M204196</link>
      <description>&lt;P&gt;Add some variables to make it possible.&amp;nbsp; Looks like you need to add a variable to group the types of records and then something to indicate which one is a subgroup.&amp;nbsp; And if you want to sort the groups by the group total then that also needs to be another variable.&amp;nbsp; So if you data looks like this and is in some unwanted order:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
  infile cards dsd dlm='|' truncover ;
  input grp subgrp Label :$30. Mild Moderate Severe Total ;
  if subgrp=1 then grandtotal=total;
  retain grandtotal;
cards;
1|1|Number of subjects dosed| | | |6
2|1|Number of subjects with an Event|2|1|0|3
4|1|NervousSystem Disorders|2|0|0|2
4|2|Headache|1|0|0|1
4|2|Parasthesia|1|0|0|1
5|1|Gastrointestinal disorders|1|0|0|1
5|2|Vomiting|1|0|0|1
7|1|General Disorder|1|0|0|1
7|2|Chills|1|0|0|1
3|1|Injury,poisoning and other|1|1|0|1
3|2|other|1|1|0|1
6|1|Prodeduralheadache|1|1|0|1
6|2|prodeduralpain|1|0|0|1
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can now sort it to print in the order you want.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=have ;
  by  descending grandtotal grp subgrp descending total;
run;
proc print noobs;
 var label  Mild Moderate Severe Total ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Label                             Mild    Moderate    Severe    Total

Number of subjects dosed            .         .          .        6
Number of subjects with an Eve      2         1          0        3
NervousSystem Disorders             2         0          0        2
Headache                            1         0          0        1
Parasthesia                         1         0          0        1
Injury,poisoning and other          1         1          0        1
other                               1         1          0        1
Gastrointestinal disorders          1         0          0        1
Vomiting                            1         0          0        1
Prodeduralheadache                  1         1          0        1
prodeduralpain                      1         0          0        1
General Disorder                    1         0          0        1
Chills                              1         0          0        1&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Aug 2020 14:15:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-sort-the-values-as-per-the-highest-value-in-col5/m-p/677066#M204196</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-08-16T14:15:39Z</dc:date>
    </item>
  </channel>
</rss>

