<?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 - Order the Variable with an Exception? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-Order-the-Variable-with-an-Exception/m-p/305007#M65012</link>
    <description>&lt;P&gt;Thank you very much. The following code worked.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Want;
Set Have;
Group = (Variable =:'W');
Run;

Proc Sort Data=Want;
By Group Variable;
Run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 17 Oct 2016 08:20:27 GMT</pubDate>
    <dc:creator>turcay</dc:creator>
    <dc:date>2016-10-17T08:20:27Z</dc:date>
    <item>
      <title>How to - Order the Variable with an Exception?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Order-the-Variable-with-an-Exception/m-p/304869#M64940</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I try to order my variable values. I can order by using PROC SORT but&amp;nbsp;on the other hand I also want to add the values which is began "W" letter at the end of column.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can somebody help me to order my variable?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Have;
Length Variable $ 20 Value 8;
Infile Datalines Missover;
Input Variable Value;
Datalines;
House 10
Car 5
Yakuza 15
Zebra 20
Home 10
W_House 5
W_Car 20
W_Yakuza 5
W_Zebra 15
W_Home 10
;
Run;

Proc Sort Data=Have;
By Variable;
Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My desired output as below;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/5305i70987055F817E8AB/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="Desired.png" title="Desired.png" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Sat, 15 Oct 2016 13:29:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Order-the-Variable-with-an-Exception/m-p/304869#M64940</guid>
      <dc:creator>turcay</dc:creator>
      <dc:date>2016-10-15T13:29:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to - Order the Variable with an Exception?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Order-the-Variable-with-an-Exception/m-p/304870#M64941</link>
      <description>&lt;P&gt;You will need to create a new variable that indicates whether the value begins with "W". &amp;nbsp;For example, add to the DATA step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;group = (variable =: 'W');&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then when you sort, you can sort:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;by group variable;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's up to you whether you want to check for "W" or "W_" ... either is possible.&lt;/P&gt;</description>
      <pubDate>Sat, 15 Oct 2016 13:44:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Order-the-Variable-with-an-Exception/m-p/304870#M64941</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-10-15T13:44:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to - Order the Variable with an Exception?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Order-the-Variable-with-an-Exception/m-p/305007#M65012</link>
      <description>&lt;P&gt;Thank you very much. The following code worked.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Want;
Set Have;
Group = (Variable =:'W');
Run;

Proc Sort Data=Want;
By Group Variable;
Run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 17 Oct 2016 08:20:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Order-the-Variable-with-an-Exception/m-p/305007#M65012</guid>
      <dc:creator>turcay</dc:creator>
      <dc:date>2016-10-17T08:20:27Z</dc:date>
    </item>
  </channel>
</rss>

