<?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: Order values in a row in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Order-values-in-a-row/m-p/428152#M105678</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;: I have to disagree! Datastep code, in my experience, almost always works faster than a proc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since I'm only using SAS UE these days I can't really see the effects on a "large" dataset, but below is an example on just a&amp;nbsp;2 million record file (expanded from the original example).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As you can see, the whole process only took .45 seconds using datastep code, while just the initial proc transpose took&amp;nbsp;1.34 seconds.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, for comparison purposes, I included a conversion from wide to long using the %untranspose macro (&lt;A href="http://www.sascommunity.org/wiki/An_Easier_and_Faster_Way_to_Untranspose_a_Wide_File" target="_blank"&gt;http://www.sascommunity.org/wiki/An_Easier_and_Faster_Way_to_Untranspose_a_Wide_File&lt;/A&gt; .. which uses datastep code) that we'll be presenting at this year's SGF. As you'll see, if you run the test code, it does the untransposition task in just .16 seconds.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;PRE&gt;/*time comparisons on a 2 million record file*/&lt;BR /&gt;data have (drop=i);
  input Variable1-Variable3;
  if _n_ eq 1 then do;
    do i=1 to 1000000;
      id=put(i,8.);
      output;
    end;
  end;
  else do;
    do i=1000001 to 2000000;
      id=put(i,8.);
      output;
    end;
  end;
  datalines;
33 45 21
13 18 25
;

proc transpose data=have out=need (rename=(Col1=value));
  by id;
  var variable1-variable3;
run;
/* cpu time: 1.34 seconds */

/* using the %untranspose macro (http://www.sascommunity.org/wiki/An_Easier_and_Faster_Way_to_Untranspose_a_Wide_File )*/
%untranspose(data=have, out=need, var=variable, id=position,by=id)
/* cpu time: 0.16 seconds */

data want (drop=i);
  set have;
  array have(3) var:;
  array sorted(3) _temporary_;
  array order(3);
  do i=1 to 3;
    sorted(i)=have(i);
  end;
  call sortn(sorted(3),sorted(2),sorted(1));
  do i=1 to 3;
    order(i)=whichn(sorted(i),of have(*));
  end;
run;
/* cpu time: 0.45 seconds */
&lt;/PRE&gt;</description>
    <pubDate>Tue, 16 Jan 2018 20:16:44 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2018-01-16T20:16:44Z</dc:date>
    <item>
      <title>Order values in a row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Order-values-in-a-row/m-p/428101#M105649</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following situation:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Id &amp;nbsp; &amp;nbsp;Variable1 &amp;nbsp; &amp;nbsp;Variable 2 &amp;nbsp; &amp;nbsp; Variable 3&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;A &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 33 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;45 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 21&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;B &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 13 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;18 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 25&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I like to know the order of the value of variable 1, for each row, compared with variable 2 and 3. The expected results will be:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Id &amp;nbsp; &amp;nbsp;Variable1 &amp;nbsp; &amp;nbsp;Variable 2 &amp;nbsp; &amp;nbsp; Variable 3 &amp;nbsp; &amp;nbsp; &amp;nbsp;Order1 &amp;nbsp; &amp;nbsp; &amp;nbsp;Order2 &amp;nbsp; &amp;nbsp;Order 3&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;A &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 33 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;45 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 21 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3 &amp;nbsp;&lt;/EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;B &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 13 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;18 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 25 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thats means, for Id "A", the variable 1 is the second largest compared with variable 2 and 3, so the new variable Order1 has value 2. The variable 2, has the greatest value, so Order2 is 1, etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 17:21:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Order-values-in-a-row/m-p/428101#M105649</guid>
      <dc:creator>MariaD</dc:creator>
      <dc:date>2018-01-16T17:21:42Z</dc:date>
    </item>
    <item>
      <title>Re: Order values in a row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Order-values-in-a-row/m-p/428104#M105651</link>
      <description>&lt;P&gt;This is very simple if you do a transpose of your original data, and then run PROC RANK to get the orders.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 17:32:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Order-values-in-a-row/m-p/428104#M105651</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-01-16T17:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: Order values in a row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Order-values-in-a-row/m-p/428105#M105652</link>
      <description>&lt;PRE&gt;data have;&lt;BR /&gt;input Id$ Variable1-Variable3;&lt;BR /&gt;datalines;&lt;BR /&gt;A 33 45 21&lt;BR /&gt;B 13 18 25&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;proc transpose data=have out=have_long(rename=(_NAME_=variable COL1=value));&lt;BR /&gt; by ID;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;proc rank data=have_long out=want;&lt;BR /&gt; by ID;&lt;BR /&gt; var value;&lt;BR /&gt; ranks order;&lt;BR /&gt;run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Jan 2018 17:43:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Order-values-in-a-row/m-p/428105#M105652</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-01-16T17:43:33Z</dc:date>
    </item>
    <item>
      <title>Re: Order values in a row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Order-values-in-a-row/m-p/428107#M105654</link>
      <description>&lt;P&gt;Neat suggestion by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;and demo by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;, However you may need another transpose after proc rank step that is if we(the community) want to meet OP's requirement.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 17:37:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Order-values-in-a-row/m-p/428107#M105654</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-01-16T17:37:55Z</dc:date>
    </item>
    <item>
      <title>Re: Order values in a row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Order-values-in-a-row/m-p/428112#M105657</link>
      <description>&lt;P&gt;You can also do it using a datastep. e.g.:&lt;/P&gt;
&lt;PRE&gt;data have;
  input Id$ Variable1-Variable3;
  datalines;
A 33 45 21
B 13 18 25
;

data want (drop=i);
  set have;
  array have(3) var:;
  array sorted(3) _temporary_;
  array order(3);
  do i=1 to 3;
    sorted(i)=have(i);
  end;
  call sortn(sorted(3),sorted(2),sorted(1));
  do i=1 to 3;
    order(i)=whichn(sorted(i),of have(*));
  end;
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 18:03:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Order-values-in-a-row/m-p/428112#M105657</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-01-16T18:03:18Z</dc:date>
    </item>
    <item>
      <title>Re: Order values in a row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Order-values-in-a-row/m-p/428122#M105664</link>
      <description>&lt;P&gt;Thanks! That's correct, &amp;nbsp;I'm looking for some solutions that not require applied more than one transpose.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 18:36:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Order-values-in-a-row/m-p/428122#M105664</guid>
      <dc:creator>MariaD</dc:creator>
      <dc:date>2018-01-16T18:36:05Z</dc:date>
    </item>
    <item>
      <title>Re: Order values in a row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Order-values-in-a-row/m-p/428126#M105667</link>
      <description>&lt;P&gt;Well&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt;&amp;nbsp;the genius always has it slick before ordinary blokes like me could provide one.Take his and often read his posts I think hall of famers like him should pariticipate a bit slowly. lol hahahaha All the Best!&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 18:52:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Order-values-in-a-row/m-p/428126#M105667</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-01-16T18:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: Order values in a row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Order-values-in-a-row/m-p/428132#M105671</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/36451"&gt;@MariaD&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Thanks! That's correct, &amp;nbsp;I'm looking for some solutions that not require applied more than one transpose.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It's not really clear why you don't want to transpose your data twice, it's relatively safe and quick (unless you have a HUGE data set); this is also much simpler (in my opinion) that the brilliant solution from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt;, and has the benefit that the algorithms used are thoroughly tested and debugged, and also has the benefit that you can specify how ties are handled. I usually advise people to use built-in solutions (e.g. SAS PROCs), than trying to write your own code and then confirming that you got it right and it handles all situations properly.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 19:00:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Order-values-in-a-row/m-p/428132#M105671</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-01-16T19:00:12Z</dc:date>
    </item>
    <item>
      <title>Re: Order values in a row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Order-values-in-a-row/m-p/428133#M105672</link>
      <description>&lt;P&gt;Here's a simple approach.&amp;nbsp; It's nowhere near as flexible as &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt;'s program (since it only handles exactly 3 incoming variables).&amp;nbsp; But it's simple enough that a junior programmer can understand it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;order1=2;&lt;/P&gt;
&lt;P&gt;order2=2;&lt;/P&gt;
&lt;P&gt;order3=2;&lt;/P&gt;
&lt;P&gt;if variable1 = max(of variable1-variable3) then order1=1;&lt;/P&gt;
&lt;P&gt;else if variable1 = min(of variable1-variable3) then order1=3;&lt;/P&gt;
&lt;P&gt;if variable2 = max(of variable1-variable3) then order2=1;&lt;/P&gt;
&lt;P&gt;else if variable2 = min(of variable1-variable3) then order2=3;&lt;/P&gt;
&lt;P&gt;if variable3 = max(of variable1-variable3) then order3=1;&lt;/P&gt;
&lt;P&gt;else if variable3 = min(of variable1-variable3) then order3=3;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 19:04:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Order-values-in-a-row/m-p/428133#M105672</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-01-16T19:04:07Z</dc:date>
    </item>
    <item>
      <title>Re: Order values in a row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Order-values-in-a-row/m-p/428134#M105673</link>
      <description>&lt;P&gt;First at all, thanks so much all of you for greats ideas.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;, I have a huge table (hundred of million of records) so I like to consider all possible options to choose the most optimal for it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 19:06:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Order-values-in-a-row/m-p/428134#M105673</guid>
      <dc:creator>MariaD</dc:creator>
      <dc:date>2018-01-16T19:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: Order values in a row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Order-values-in-a-row/m-p/428135#M105674</link>
      <description>&lt;P&gt;Well,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/36451"&gt;@MariaD&lt;/a&gt;, having thought about it some more, I would think that a PROC would still handle HUGE datasets faster than data step code. But I admit I don't know that this is the right answer in your case. I guess the only way to find out is to try it.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 19:23:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Order-values-in-a-row/m-p/428135#M105674</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-01-16T19:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: Order values in a row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Order-values-in-a-row/m-p/428152#M105678</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;: I have to disagree! Datastep code, in my experience, almost always works faster than a proc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since I'm only using SAS UE these days I can't really see the effects on a "large" dataset, but below is an example on just a&amp;nbsp;2 million record file (expanded from the original example).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As you can see, the whole process only took .45 seconds using datastep code, while just the initial proc transpose took&amp;nbsp;1.34 seconds.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, for comparison purposes, I included a conversion from wide to long using the %untranspose macro (&lt;A href="http://www.sascommunity.org/wiki/An_Easier_and_Faster_Way_to_Untranspose_a_Wide_File" target="_blank"&gt;http://www.sascommunity.org/wiki/An_Easier_and_Faster_Way_to_Untranspose_a_Wide_File&lt;/A&gt; .. which uses datastep code) that we'll be presenting at this year's SGF. As you'll see, if you run the test code, it does the untransposition task in just .16 seconds.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;PRE&gt;/*time comparisons on a 2 million record file*/&lt;BR /&gt;data have (drop=i);
  input Variable1-Variable3;
  if _n_ eq 1 then do;
    do i=1 to 1000000;
      id=put(i,8.);
      output;
    end;
  end;
  else do;
    do i=1000001 to 2000000;
      id=put(i,8.);
      output;
    end;
  end;
  datalines;
33 45 21
13 18 25
;

proc transpose data=have out=need (rename=(Col1=value));
  by id;
  var variable1-variable3;
run;
/* cpu time: 1.34 seconds */

/* using the %untranspose macro (http://www.sascommunity.org/wiki/An_Easier_and_Faster_Way_to_Untranspose_a_Wide_File )*/
%untranspose(data=have, out=need, var=variable, id=position,by=id)
/* cpu time: 0.16 seconds */

data want (drop=i);
  set have;
  array have(3) var:;
  array sorted(3) _temporary_;
  array order(3);
  do i=1 to 3;
    sorted(i)=have(i);
  end;
  call sortn(sorted(3),sorted(2),sorted(1));
  do i=1 to 3;
    order(i)=whichn(sorted(i),of have(*));
  end;
run;
/* cpu time: 0.45 seconds */
&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Jan 2018 20:16:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Order-values-in-a-row/m-p/428152#M105678</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-01-16T20:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: Order values in a row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Order-values-in-a-row/m-p/428157#M105681</link>
      <description>&lt;P&gt;That's good to know!&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 20:27:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Order-values-in-a-row/m-p/428157#M105681</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-01-16T20:27:58Z</dc:date>
    </item>
    <item>
      <title>Re: Order values in a row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Order-values-in-a-row/m-p/428346#M105759</link>
      <description>&lt;P&gt;It is really easy for IML.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Id$ Variable1-Variable3;
datalines;
A 33 45 21
B 13 18 25
;

proc iml;
use have nobs nobs;
read all var _num_ into  x;
close;
rank=j(nrow(x),ncol(x));
do i=1 to nobs;
rank[i,]=ranktie(x[i,],'dense');
end;
create temp from rank;
append from rank;
close;
quit;

data want;
 merge have temp;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Jan 2018 13:28:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Order-values-in-a-row/m-p/428346#M105759</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-01-17T13:28:37Z</dc:date>
    </item>
  </channel>
</rss>

