<?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: Ranking values in Columns in Sequence in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Ranking-values-in-Columns-in-Sequence/m-p/483407#M125346</link>
    <description>&lt;P&gt;Yep:&lt;/P&gt;
&lt;P&gt;1) Normalise the have dataset to&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Respondant_ID Question&amp;nbsp; Response&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) Process the normalised dataset to set the new variable names, i.e. if response=1 then qname="Rank 1"&lt;/P&gt;
&lt;P&gt;3) Transpose the data back up again based on the processed new variable name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Post test data in the form of a datastep for working code.&lt;/P&gt;</description>
    <pubDate>Thu, 02 Aug 2018 14:24:32 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-08-02T14:24:32Z</dc:date>
    <item>
      <title>Ranking values in Columns in Sequence</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Ranking-values-in-Columns-in-Sequence/m-p/483400#M125345</link>
      <description>&lt;DIV class="votecell post-layout--left"&gt;&lt;DIV class="vote"&gt;Hi,&lt;BR /&gt;&lt;DIV class="favoritecount"&gt;I have received an output of data from a survey that was recently sent out. Please see a data example below;&lt;/DIV&gt;&lt;DIV class="favoritecount"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="favoritecount"&gt;&lt;IMG src="https://i.stack.imgur.com/C67i6.png" border="0" alt="enter image description here" /&gt;&lt;/DIV&gt;&lt;DIV class="favoritecount"&gt;&lt;P&gt;I basically want to reorder the Data by rank order in columns depending what number is in each cell. Any ideas of the best way to do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 02 Aug 2018 14:14:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Ranking-values-in-Columns-in-Sequence/m-p/483400#M125345</guid>
      <dc:creator>cmoore</dc:creator>
      <dc:date>2018-08-02T14:14:47Z</dc:date>
    </item>
    <item>
      <title>Re: Ranking values in Columns in Sequence</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Ranking-values-in-Columns-in-Sequence/m-p/483407#M125346</link>
      <description>&lt;P&gt;Yep:&lt;/P&gt;
&lt;P&gt;1) Normalise the have dataset to&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Respondant_ID Question&amp;nbsp; Response&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) Process the normalised dataset to set the new variable names, i.e. if response=1 then qname="Rank 1"&lt;/P&gt;
&lt;P&gt;3) Transpose the data back up again based on the processed new variable name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Post test data in the form of a datastep for working code.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Aug 2018 14:24:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Ranking-values-in-Columns-in-Sequence/m-p/483407#M125346</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-08-02T14:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: Ranking values in Columns in Sequence</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Ranking-values-in-Columns-in-Sequence/m-p/483443#M125355</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/136670"&gt;@cmoore&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;DIV class="votecell post-layout--left"&gt;
&lt;DIV class="vote"&gt;Hi,&lt;BR /&gt;
&lt;DIV class="favoritecount"&gt;I have received an output of data from a survey that was recently sent out. Please see a data example below;&lt;/DIV&gt;
&lt;DIV class="favoritecount"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="favoritecount"&gt;&lt;IMG alt="enter image description here" src="https://i.stack.imgur.com/C67i6.png" border="0" /&gt;&lt;/DIV&gt;
&lt;DIV class="favoritecount"&gt;
&lt;P&gt;I basically want to reorder the Data by rank order in columns depending what number is in each cell. Any ideas of the best way to do this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Chris&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Have you examined your data so that you can verify that there are never more than 5 "notranked" for any respondent? That none of the respondents ranked any items with the same rank? [ I know that may not have been intended but some surveys / survey software end up allowing such depending on how carefully the data collection staff was trained or the survey script programmed.]&lt;/P&gt;
&lt;P&gt;Are there any actually missing values that need to treated differently than "not ranked"?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The values you show imply that the variables would have to be character but there is a chance they are actually numeric and "not ranked" is missing and that text&amp;nbsp;applied with a custom format. Is that the case?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If everything has exactly 5 ranked, with full ranks of 1 to 5, and 5 not ranked, and the variables are in the order as shown and adjacent this might get you started:&lt;/P&gt;
&lt;P&gt;Untested as NO data set provided and I'm not going to make one.&lt;/P&gt;
&lt;PRE&gt;data want;
   set have;
   array s Capability -- Reputation;
   array r{10} $15 Rank1-Rank5 NotRanked1-NotRanked5;
   notcount=0;
   do = 1 to dim(s);
      j= input(s[i],f1.);
      if j&amp;gt;0 then r[j]= vname(s[i]);
      else do;
         notcount=notcount+1;
         r[5+notcount] = vname(s[i]);
      end;
   end;
   keep Respondent_id Rank1-Rank5 NotRanked1-NotRanked5;
run;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Aug 2018 15:25:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Ranking-values-in-Columns-in-Sequence/m-p/483443#M125355</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-08-02T15:25:03Z</dc:date>
    </item>
  </channel>
</rss>

