<?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: Where statement with double digits in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Where-statement-with-double-digits/m-p/447423#M69524</link>
    <description>&lt;P&gt;Interval comparisons with character values do not use the numeric values for comparison. Since 2&amp;gt;1 in character values then '1vs2' is greater than '1vs16'. Since you state 16 treatments I am assuming that you have none such as '1vs18' that might have been included.&lt;/P&gt;
&lt;P&gt;Please see for an example of sort order which is used in "between" comparisons:&lt;/P&gt;
&lt;PRE&gt;data junk;
   length str $ 5;
   do i=1 to 16;
      str=cats('1vs',i);
      output;
   end;
run;

proc sort data=junk;
   by str;
run;

proc print data=junk;
   var str;
run;&lt;/PRE&gt;
&lt;P&gt;If you want that kind of name to compare properly with "between"&amp;nbsp;you would have to have values for comparison like '1vs02', not '1vs2'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or list the exact values you want in the where statement.&lt;/P&gt;</description>
    <pubDate>Wed, 21 Mar 2018 14:26:25 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-03-21T14:26:25Z</dc:date>
    <item>
      <title>Where statement with double digits</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Where-statement-with-double-digits/m-p/447398#M69521</link>
      <description>&lt;P&gt;After running a mixed model on 16 different treatments, where I also compare among the treatments I save the differences in a new file. With this new file I run a proc sgplot to create a difference plot showing the differences with respective confidence limit. In order for me to make this readable I put in a where between and statement to have it select all the differences for the comparisons between treatment 1vs2 till 1vs16. For some reason it fails to show what I want it to show when the second part contains double digits. To show what happens:&lt;BR /&gt;&lt;BR /&gt;proc sgplot data=differences noautolegend;&lt;BR /&gt;where comparison between '1vs2' and'1vs9';&lt;/P&gt;&lt;P&gt;--&amp;gt;gives me the plot showing all comparisons between 1vs2 till 1vs9&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="image.png" style="width: 160px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/19359i3E993ADC01B92C91/image-dimensions/160x120?v=v2" width="160" height="120" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;proc sgplot data=differences noautolegend;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;where comparison between '1vs2' and'1vs16'&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;--&amp;gt;only gives me the differences for 1vs2 and 1vs16 without any in between&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 200px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/19358iA1F7795AEE1B2AE6/image-dimensions/200x150?v=v2" width="200" height="150" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It has to do with the second 1vs statement having double digits, because as soon as I change that it messes up the graph. It has to do with the way SAS reads this comparison, but does anyone have a solution for this??&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks in advance,&lt;BR /&gt;Gavin&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Mar 2018 13:02:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Where-statement-with-double-digits/m-p/447398#M69521</guid>
      <dc:creator>GavinB</dc:creator>
      <dc:date>2018-03-21T13:02:49Z</dc:date>
    </item>
    <item>
      <title>Re: Where statement with double digits</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Where-statement-with-double-digits/m-p/447423#M69524</link>
      <description>&lt;P&gt;Interval comparisons with character values do not use the numeric values for comparison. Since 2&amp;gt;1 in character values then '1vs2' is greater than '1vs16'. Since you state 16 treatments I am assuming that you have none such as '1vs18' that might have been included.&lt;/P&gt;
&lt;P&gt;Please see for an example of sort order which is used in "between" comparisons:&lt;/P&gt;
&lt;PRE&gt;data junk;
   length str $ 5;
   do i=1 to 16;
      str=cats('1vs',i);
      output;
   end;
run;

proc sort data=junk;
   by str;
run;

proc print data=junk;
   var str;
run;&lt;/PRE&gt;
&lt;P&gt;If you want that kind of name to compare properly with "between"&amp;nbsp;you would have to have values for comparison like '1vs02', not '1vs2'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or list the exact values you want in the where statement.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Mar 2018 14:26:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Where-statement-with-double-digits/m-p/447423#M69524</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-03-21T14:26:25Z</dc:date>
    </item>
    <item>
      <title>Re: Where statement with double digits</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Where-statement-with-double-digits/m-p/447457#M69525</link>
      <description>&lt;P&gt;That's because the comparison of '1vs1' and '1vs16' is using "lexicographic ordering".&amp;nbsp;&amp;nbsp; And since your lower-order versions are vs1, vs2, ... vs9&amp;nbsp; instead of 'vs01','vs02',... 'vs09', you don't have the option of &lt;EM&gt;&lt;STRONG&gt;where comparison between '1vs01' and '1vs16'&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;EM&gt;&lt;STRONG&gt;where (comparison between '1vs2' and '1vs9') or (comparison between '1vs10' and '1vs16')&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Mar 2018 15:49:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Where-statement-with-double-digits/m-p/447457#M69525</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-03-21T15:49:49Z</dc:date>
    </item>
  </channel>
</rss>

