<?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: What's wrong with this format? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/What-s-wrong-with-this-format/m-p/511383#M137608</link>
    <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt; Thanks ..this worked</description>
    <pubDate>Thu, 08 Nov 2018 14:16:01 GMT</pubDate>
    <dc:creator>sri1</dc:creator>
    <dc:date>2018-11-08T14:16:01Z</dc:date>
    <item>
      <title>What's wrong with this format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-s-wrong-with-this-format/m-p/510992#M137534</link>
      <description>&lt;P&gt;I have the following code and I am not getting the intended result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc format;&lt;BR /&gt;value $tem&lt;BR /&gt;'T1'-'T53','T74'="WA"&lt;BR /&gt;'T54'-'T73','T75'="MB" ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Issue:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;T8 and T9 are not getting formatted as WA&lt;/LI&gt;&lt;LI&gt;T6 and T7 are being formatted as MB instead of WA.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Your solutions are highly appreciated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 07 Nov 2018 10:25:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-s-wrong-with-this-format/m-p/510992#M137534</guid>
      <dc:creator>sri1</dc:creator>
      <dc:date>2018-11-07T10:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: What's wrong with this format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-s-wrong-with-this-format/m-p/510995#M137535</link>
      <description>&lt;P&gt;As a string, 'T8' is greater than 'T5', and therefore also greater than 'T53'.&lt;/P&gt;
&lt;P&gt;Use a do loop in a data step to create a cntlin dataset for proc format:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data cntlin;
fmtname = 'tem';
type = 'C';
label = 'WA';
do i = 1 to 53;
  start = 'T' !! strip(put(i,best.));
  output;
end;
run;

proc format cntlin=cntlin;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Add code for the second range and the single values not in the ranges.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Nov 2018 11:23:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-s-wrong-with-this-format/m-p/510995#M137535</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-11-07T11:23:03Z</dc:date>
    </item>
    <item>
      <title>Re: What's wrong with this format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-s-wrong-with-this-format/m-p/511055#M137536</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/80196"&gt;@sri1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have the following code and I am not getting the intended result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc format;&lt;BR /&gt;value $tem&lt;BR /&gt;'T1'-'T53','T74'="WA"&lt;BR /&gt;'T54'-'T73','T75'="MB" ;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Issue:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;T8 and T9 are not getting formatted as WA&lt;/LI&gt;
&lt;LI&gt;T6 and T7 are being formatted as MB instead of WA.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Your solutions are highly appreciated&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Intervals and character values do not play well together because character values use ASCII character comparisons, not Character + partial-characters-converted-to-numeric.&lt;/P&gt;
&lt;P&gt;Either use an explicit list or ensure that the data values will compare the way you think they should such as "T08 instead of "T8". Of course if you go to "T100" then you need "T008" to use an interval.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Nov 2018 15:39:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-s-wrong-with-this-format/m-p/511055#M137536</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-11-07T15:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: What's wrong with this format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-s-wrong-with-this-format/m-p/511368#M137603</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt; Thanks for response.I have tried using T01 instead of T1 in the format but didn't work.Is that what you mean&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Thu, 08 Nov 2018 13:47:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-s-wrong-with-this-format/m-p/511368#M137603</guid>
      <dc:creator>sri1</dc:creator>
      <dc:date>2018-11-08T13:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: What's wrong with this format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-s-wrong-with-this-format/m-p/511383#M137608</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt; Thanks ..this worked</description>
      <pubDate>Thu, 08 Nov 2018 14:16:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-s-wrong-with-this-format/m-p/511383#M137608</guid>
      <dc:creator>sri1</dc:creator>
      <dc:date>2018-11-08T14:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: What's wrong with this format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-s-wrong-with-this-format/m-p/511549#M137682</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/80196"&gt;@sri1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt; Thanks for response.I have tried using T01 instead of T1 in the format but didn't work.Is that what you mean&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Value formats are going to have to match the actual values. If your value is "T8" then using "T08" in the format won't help.&lt;/P&gt;
&lt;P&gt;The values would have to actually be "T08".&lt;/P&gt;
&lt;P&gt;In which case a range &lt;STRONG&gt;may&lt;/STRONG&gt; work.&lt;/P&gt;
&lt;P&gt;Please consider:&lt;/P&gt;
&lt;PRE&gt;Proc format library=work;
value $tt
"T01" - "T09"= 'abc'
"T10" - "T15"= 'pdq'
;
run;

data example;
   input v $;
datalines;
T01
T02
T03
T04
T05
T06
T07
T08
T09
T10
T11
T12
T13
T14
T15
t01
T8
T011
T101
;
run;

proc print data=example;
  format v $tt.;
run;&lt;/PRE&gt;
&lt;P&gt;Note that if the letter case is different then the format doesn't find a match. That T8 does not find a match to format in the example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And T011 is treated the same as T01, as T101 formatted the same as T10. These last two are because T011 &amp;gt; T01 as the last 1 is greater than a blank but since the third character 1 is before the 9 it is &amp;lt; T09 and similar for the T101.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So your actual values have to be very closely considered if attempting to do anything with a range of character values. Generally it is going to be more reliable with explicit value lists though ranges may be useful if you are working with things more like T01.1 to T01.999.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Nov 2018 21:49:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-s-wrong-with-this-format/m-p/511549#M137682</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-11-08T21:49:37Z</dc:date>
    </item>
  </channel>
</rss>

