<?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: User defined informats in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/User-defined-informats/m-p/173957#M44790</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi chouchou,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Others have shown that your INFORMAT is not OK for your purpose. I hope to show you what is happening behind the scenes by examples.&lt;/P&gt;&lt;P&gt;Your value ranges&lt;/P&gt;&lt;P&gt;0 - &amp;lt; 65 , ..... 85 - &amp;lt; 100&lt;/P&gt;&lt;P&gt;produce ERROR. Understanding the reason for this error will get you back to seeking other ways.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First let us stop this ERROR, by a small change in the first and last Range as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format;&lt;/P&gt;&lt;P&gt;invalue $conv&lt;/P&gt;&lt;P&gt;0.001 - &amp;lt; 65 = 'F'&lt;/P&gt;&lt;P&gt;65 -&amp;lt; 75 = 'C'&lt;/P&gt;&lt;P&gt;75 - &amp;lt; 85 = 'B'&lt;/P&gt;&lt;P&gt;85 -&amp;nbsp; 99.999 = 'A'&lt;/P&gt;&lt;P&gt;other = 'Not defined yet ';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this modification may not alter much of your specification. Run this and see that the ERROR is not there.&amp;nbsp; We will see later why this happened.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Next is, how you will read X - as numeric or character from the input file ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[1] Let X be numeric as in this input file:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;infile cards truncover;&lt;/P&gt;&lt;P&gt;*input x $3.;&lt;/P&gt;&lt;P&gt;input x;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;3&lt;/P&gt;&lt;P&gt;50&lt;/P&gt;&lt;P&gt;57&lt;/P&gt;&lt;P&gt;58&lt;/P&gt;&lt;P&gt;68&lt;/P&gt;&lt;P&gt;69&lt;/P&gt;&lt;P&gt;70&lt;/P&gt;&lt;P&gt;71&lt;/P&gt;&lt;P&gt;78&lt;/P&gt;&lt;P&gt;79&lt;/P&gt;&lt;P&gt;80&lt;/P&gt;&lt;P&gt;82&lt;/P&gt;&lt;P&gt;89&lt;/P&gt;&lt;P&gt;90&lt;/P&gt;&lt;P&gt;91&lt;/P&gt;&lt;P&gt;96&lt;/P&gt;&lt;P&gt;99&lt;/P&gt;&lt;P&gt;100&lt;/P&gt;&lt;P&gt;120&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now apply the INFORMAT on X as below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; x1 = input(x, $conv.);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See the output of the data set, WANT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print data = want;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All your X's are transformed to&amp;nbsp; 'Net defined yet' as only 'other' is applicable for all X's. Why, wait for some time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[2] Now let X be character Variable.&lt;/P&gt;&lt;P&gt;In the above input file, read X as $3 instead as number and run the following code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13.6000003814697px;"&gt;data want;&lt;/P&gt;&lt;P style="font-size: 13.6000003814697px;"&gt;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P style="font-size: 13.6000003814697px;"&gt;&amp;nbsp;&amp;nbsp; x1 = input(x, $conv.);&lt;/P&gt;&lt;P style="font-size: 13.6000003814697px;"&gt;run;&lt;/P&gt;&lt;P style="font-size: 13.6000003814697px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.6000003814697px;"&gt;and see the output of the data set WANT:&lt;/P&gt;&lt;P style="font-size: 13.6000003814697px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.6000003814697px;"&gt;proc print data = want;&lt;/P&gt;&lt;P style="font-size: 13.6000003814697px;"&gt;run;&lt;/P&gt;&lt;P style="font-size: 13.6000003814697px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.6000003814697px;"&gt;You will see that the LABELS are OK except for 100 and 120 where you are supposed to get 'Not defined yet'. The following show the reasons.&lt;/P&gt;&lt;P style="font-size: 13.6000003814697px;"&gt;&lt;/P&gt;&lt;P&gt;proc sort data = have out = havesort;&lt;/P&gt;&lt;P&gt;by x;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print data = havesort;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When X is a character variable, the sorted file shows the order as 1, 100, 120, 2, 3, 50, ...., 96, 99.&lt;/P&gt;&lt;P&gt;Therefore INFORMAT transforms 1 as F, 100 as F, 120 as F, 2 as F, ..., 58 as F, 68 as C and so on.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The lesson is that SAS treats numeric value ranges as character ranges (&lt;STRONG&gt;by default&lt;/STRONG&gt;) like '0' - &amp;lt; '65', ...., '85' - &amp;lt; '100' when&amp;nbsp; INVALUE statement (invalue $convert) is made.&lt;/P&gt;&lt;P&gt;So you can not achieve what you want by your $CONVERT Informat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now coming to another way of doing what you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Change X to Number in the Input File.&lt;/P&gt;&lt;P&gt;Use the following Format:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format;&lt;/P&gt;&lt;P&gt;value numconv&lt;/P&gt;&lt;P&gt;0 - &amp;lt; 65 = 'F'&lt;/P&gt;&lt;P&gt;65 -&amp;lt; 75 = 'C'&lt;/P&gt;&lt;P&gt;75 - &amp;lt; 85 = 'B'&lt;/P&gt;&lt;P&gt;85 -&amp;nbsp; &amp;lt;100 = 'A'&lt;/P&gt;&lt;P&gt;other = 'Not defined yet ';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now use the following code to transform X.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; x1 = put(x, numconv.);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print data = want;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: MUTHIA KACHIRAYAN&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 08 Oct 2014 10:56:00 GMT</pubDate>
    <dc:creator>KachiM</dc:creator>
    <dc:date>2014-10-08T10:56:00Z</dc:date>
    <item>
      <title>User defined informats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/User-defined-informats/m-p/173944#M44777</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys, I want to create an informat.&lt;/P&gt;&lt;P&gt;However log keeps notifying me that &lt;STRONG style="color: #ff0000;"&gt;ERROR: Start is greater than end: -.&lt;/STRONG&gt; unless I switch the number of&lt;SPAN style="color: #ff0000;"&gt; 100&lt;/SPAN&gt; to a word of &lt;SPAN style="color: #ff0000;"&gt;high&lt;/SPAN&gt;.Could anyone explain to me the reason of the error?&lt;/P&gt;&lt;P&gt;What if I want to informat numbers which are larger than 100 as "Not defined yet", how should I adjust my code and avoid the error?&lt;/P&gt;&lt;P&gt;Thank you soooo much!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format;&lt;/P&gt;&lt;P&gt;invalue $convert&lt;/P&gt;&lt;P&gt;0 - &amp;lt;65 = 'F'&lt;/P&gt;&lt;P&gt;65 -&amp;lt;75 = 'C'&lt;/P&gt;&lt;P&gt;75 - &amp;lt;85 = 'B'&lt;/P&gt;&lt;P&gt;85 - &amp;lt;&lt;SPAN style="color: #ff0000;"&gt;100&lt;/SPAN&gt; = 'A'&lt;/P&gt;&lt;P&gt;other = 'Not defined yet ';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Oct 2014 21:38:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/User-defined-informats/m-p/173944#M44777</guid>
      <dc:creator>chouchou</dc:creator>
      <dc:date>2014-10-06T21:38:36Z</dc:date>
    </item>
    <item>
      <title>Re: User defined informats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/User-defined-informats/m-p/173945#M44778</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think it is because you are treating it as a character variable. I'd think the following might do what you want:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format;&lt;/P&gt;&lt;P&gt;value converta&lt;/P&gt;&lt;P&gt;1 = 'F'&lt;/P&gt;&lt;P&gt;2 = 'C'&lt;/P&gt;&lt;P&gt;3 = 'B'&lt;/P&gt;&lt;P&gt;4 = 'A'&lt;/P&gt;&lt;P&gt;5 = 'Not defined yet ';&lt;/P&gt;&lt;P&gt;invalue convert&lt;/P&gt;&lt;P&gt;0 - &amp;lt;65 = 1&lt;/P&gt;&lt;P&gt;65 -&amp;lt;75 = 2&lt;/P&gt;&lt;P&gt;75 - &amp;lt;85 = 3&lt;/P&gt;&lt;P&gt;85 - &amp;lt;100 = 4&lt;/P&gt;&lt;P&gt;other = 5;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat x convert.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format x converta.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input x;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;66&lt;/P&gt;&lt;P&gt;76&lt;/P&gt;&lt;P&gt;86&lt;/P&gt;&lt;P&gt;100&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Oct 2014 22:47:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/User-defined-informats/m-p/173945#M44778</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2014-10-06T22:47:04Z</dc:date>
    </item>
    <item>
      <title>Re: User defined informats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/User-defined-informats/m-p/173946#M44779</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why not just use a custom display format for the values and read as numeric? Then if there is a decision to move the boundary between 'A' and 'B' to 90 you do not have to re-read the data, just assign the new format for any analysis.&lt;BR /&gt;This would also handle the issue of later changes. BTW you might want 85 - 100. Unless 100 really isn't supposed to be treated as an 'A';&lt;/P&gt;&lt;P&gt;proc format;&lt;/P&gt;&lt;P&gt;value convert&lt;/P&gt;&lt;P&gt;0 - &amp;lt;65 = 'F'&lt;/P&gt;&lt;P&gt;65 -&amp;lt;75 = 'C'&lt;/P&gt;&lt;P&gt;75 - &amp;lt;85 = 'B'&lt;/P&gt;&lt;P&gt;85 - &amp;lt;&lt;SPAN style="color: #ff0000;"&gt;100&lt;/SPAN&gt; = 'A'&lt;/P&gt;&lt;P&gt;other = 'Not defined yet ';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If this is actually assigning class grades from numeric there is another reason to leave values as the numeric and just use a format: different classes may be graded differently, i.e. "on a curve".&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Oct 2014 23:02:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/User-defined-informats/m-p/173946#M44779</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-10-06T23:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: User defined informats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/User-defined-informats/m-p/173947#M44780</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One more thought .. though I can't test it at the moment. Wouldn't the following work?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format;&lt;/P&gt;&lt;P&gt;invalue grade&lt;/P&gt;&lt;P&gt;0 - &amp;lt;65 = 'F'&lt;/P&gt;&lt;P&gt;65 - &amp;lt;75 = 'C'&lt;/P&gt;&lt;P&gt;75 - &amp;lt;85 = 'B'&lt;/P&gt;&lt;P&gt;85 - &amp;lt;100 = 'A'&lt;/P&gt;&lt;P&gt;other = 'Not defined yet ';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat x grade.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input x;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;66&lt;/P&gt;&lt;P&gt;76&lt;/P&gt;&lt;P&gt;86&lt;/P&gt;&lt;P&gt;100&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Oct 2014 23:10:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/User-defined-informats/m-p/173947#M44780</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2014-10-06T23:10:44Z</dc:date>
    </item>
    <item>
      <title>Re: User defined informats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/User-defined-informats/m-p/173948#M44781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The error comes because, SAS treats the numeric ranges as character string. In SAS Document, it says:&lt;/P&gt;&lt;P&gt;"In character informats, numeric ranges are treated as character strings."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Better you replace INVALUE by VALUE then your format works.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Oct 2014 06:02:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/User-defined-informats/m-p/173948#M44781</guid>
      <dc:creator>KachiM</dc:creator>
      <dc:date>2014-10-07T06:02:50Z</dc:date>
    </item>
    <item>
      <title>Re: User defined informats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/User-defined-informats/m-p/173949#M44782</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you should use 'low' instead of 0. This will solve your problem.&amp;nbsp; Also for example please run below code. It may help you to understand the issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format;&lt;/P&gt;&lt;P&gt;&amp;nbsp; invalue $convertc&lt;/P&gt;&lt;P&gt;&amp;nbsp; low - &amp;lt;65 = "F"&lt;/P&gt;&lt;P&gt;&amp;nbsp; 65 -&amp;lt;75 = "C"&lt;/P&gt;&lt;P&gt;&amp;nbsp; 75 - &amp;lt;85 = "B"&lt;/P&gt;&lt;P&gt;&amp;nbsp; 85 - high = "A"&lt;/P&gt;&lt;P&gt;&amp;nbsp; other = "Not defined yet";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; value convertn&lt;/P&gt;&lt;P&gt;&amp;nbsp; low - &amp;lt;65 = "F"&lt;/P&gt;&lt;P&gt;&amp;nbsp; 65 -&amp;lt;75 = "C"&lt;/P&gt;&lt;P&gt;&amp;nbsp; 75 - &amp;lt;85 = "B"&lt;/P&gt;&lt;P&gt;&amp;nbsp; 85 - high = "A"&lt;/P&gt;&lt;P&gt;&amp;nbsp; other = "Not defined yet";&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data aaa;&lt;/P&gt;&lt;P&gt;&amp;nbsp; length y $10 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; x = 0; y = '0'; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; x = 65; y = '65'; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; x = 72; y = '72'; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; x = 81; y = '81'; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; x = 88; y = '88'; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; x = 100; y = '100'; output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data bbb;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set aaa;&lt;/P&gt;&lt;P&gt;&amp;nbsp; zc = input(y, $convertc.);&lt;/P&gt;&lt;P&gt;&amp;nbsp; zn = put(x, convertn.);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Oct 2014 09:07:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/User-defined-informats/m-p/173949#M44782</guid>
      <dc:creator>AmitRathore</dc:creator>
      <dc:date>2014-10-07T09:07:15Z</dc:date>
    </item>
    <item>
      <title>Re: User defined informats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/User-defined-informats/m-p/173950#M44783</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Within the format procedure &lt;A href="http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#format-overview.htm"&gt;http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#format-overview.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it is stated:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;User-defined informats read only character data. They can convert character values into real numeric values, but they cannot convert real numbers into characters&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;that's the reason for the error message you got when trying to to define an informat for converting numbers into characters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Oct 2014 09:59:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/User-defined-informats/m-p/173950#M44783</guid>
      <dc:creator>Loko</dc:creator>
      <dc:date>2014-10-07T09:59:28Z</dc:date>
    </item>
    <item>
      <title>Re: User defined informats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/User-defined-informats/m-p/173951#M44784</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If your x values are all integers, then you could use the following approach. Note, though, that your question stated that you wanted to trap numbers larger than 100, but your code looked for numbers that included 100. I did find time to test this approach:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data fmt; &lt;/P&gt;&lt;P&gt;&amp;nbsp; retain fmtname '$convert' type 'J'; &lt;/P&gt;&lt;P&gt;&amp;nbsp; length start $8 label $15; &lt;/P&gt;&lt;P&gt;&amp;nbsp; do _n_=1 to 101;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; start=strip(put(_n_,8.));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; when (_n_ lt 65) label='F'; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; when (_n_ lt 75) label='C'; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; when (_n_ lt 85) label='B'; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; otherwise label='A'; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _n_=101 then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; start='Other';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; label= 'Not defined yet';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format cntlin=fmt; &lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat x $convert15.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input x;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;66&lt;/P&gt;&lt;P&gt;76&lt;/P&gt;&lt;P&gt;86&lt;/P&gt;&lt;P&gt;100&lt;/P&gt;&lt;P&gt;101&lt;/P&gt;&lt;P&gt;102&lt;/P&gt;&lt;P&gt;103&lt;/P&gt;&lt;P&gt;221&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Oct 2014 16:05:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/User-defined-informats/m-p/173951#M44784</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2014-10-07T16:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: User defined informats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/User-defined-informats/m-p/173952#M44785</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One last point: if you ALSO want to convert missing values to the value "Not defined yet", then the following code would be needed:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data fmt; &lt;/P&gt;&lt;P&gt;&amp;nbsp; retain fmtname '$convert' type 'J' hlo 'UJ '; &lt;/P&gt;&lt;P&gt;&amp;nbsp; length start $8 label $15; &lt;/P&gt;&lt;P&gt;&amp;nbsp; do _n_=1 to 101;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; start=strip(put(_n_,8.));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; when (_n_ lt 65) label='F'; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; when (_n_ lt 75) label='C'; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; when (_n_ lt 85) label='B'; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; otherwise label='A'; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _n_=101 then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; hlo = 'UJO';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; start='Other';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; label= 'Not defined yet';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format cntlin=fmt; &lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile cards truncover;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input x $convert15.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;66&lt;/P&gt;&lt;P&gt;76&lt;/P&gt;&lt;P&gt;86&lt;/P&gt;&lt;P&gt;100&lt;/P&gt;&lt;P&gt;101&lt;/P&gt;&lt;P&gt;102&lt;/P&gt;&lt;P&gt;103&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;221&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Oct 2014 17:35:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/User-defined-informats/m-p/173952#M44785</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2014-10-07T17:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: User defined informats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/User-defined-informats/m-p/173953#M44786</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Amit, you're correct, but the problem is that I need to keep the boundary 85-&amp;lt;100 and leave the numbers larger than 100 as "other". Do you have any idea?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Oct 2014 20:29:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/User-defined-informats/m-p/173953#M44786</guid>
      <dc:creator>chouchou</dc:creator>
      <dc:date>2014-10-07T20:29:29Z</dc:date>
    </item>
    <item>
      <title>Re: User defined informats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/User-defined-informats/m-p/173954#M44787</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Arthur,&lt;/P&gt;&lt;P&gt;Thank you for your time and it's really a great and different way of thinking.&lt;/P&gt;&lt;P&gt;But I'm still struggle with the proc format; invalue..... statement (not proc format;value.....), why I set a boundary of 100 and it doesn't work. It's just too weird!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Oct 2014 20:41:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/User-defined-informats/m-p/173954#M44787</guid>
      <dc:creator>chouchou</dc:creator>
      <dc:date>2014-10-07T20:41:22Z</dc:date>
    </item>
    <item>
      <title>Re: User defined informats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/User-defined-informats/m-p/173955#M44788</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your original code didn't work correctly with or without including 99. To see what I mean, try the following and look at the results. When looking at characters, rather than numbers, the sort order is totally different:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format;&lt;/P&gt;&lt;P&gt;invalue $convert&lt;/P&gt;&lt;P&gt;0 - &amp;lt;65 = 'F'&lt;/P&gt;&lt;P&gt;65 -&amp;lt;75 = 'C'&lt;/P&gt;&lt;P&gt;75 - &amp;lt;85 = 'B'&lt;/P&gt;&lt;P&gt;85 - &amp;lt;99 = 'A'&lt;/P&gt;&lt;P&gt;other = 'Not defined yet ';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile cards truncover;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input x $convert15.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;3&lt;/P&gt;&lt;P&gt;4&lt;/P&gt;&lt;P&gt;5&lt;/P&gt;&lt;P&gt;6&lt;/P&gt;&lt;P&gt;7&lt;/P&gt;&lt;P&gt;8&lt;/P&gt;&lt;P&gt;9&lt;/P&gt;&lt;P&gt;10&lt;/P&gt;&lt;P&gt;11&lt;/P&gt;&lt;P&gt;12&lt;/P&gt;&lt;P&gt;13&lt;/P&gt;&lt;P&gt;14&lt;/P&gt;&lt;P&gt;15&lt;/P&gt;&lt;P&gt;16&lt;/P&gt;&lt;P&gt;17&lt;/P&gt;&lt;P&gt;18&lt;/P&gt;&lt;P&gt;19&lt;/P&gt;&lt;P&gt;20&lt;/P&gt;&lt;P&gt;21&lt;/P&gt;&lt;P&gt;22&lt;/P&gt;&lt;P&gt;23&lt;/P&gt;&lt;P&gt;24&lt;/P&gt;&lt;P&gt;25&lt;/P&gt;&lt;P&gt;26&lt;/P&gt;&lt;P&gt;27&lt;/P&gt;&lt;P&gt;28&lt;/P&gt;&lt;P&gt;29&lt;/P&gt;&lt;P&gt;30&lt;/P&gt;&lt;P&gt;31&lt;/P&gt;&lt;P&gt;32&lt;/P&gt;&lt;P&gt;33&lt;/P&gt;&lt;P&gt;34&lt;/P&gt;&lt;P&gt;35&lt;/P&gt;&lt;P&gt;36&lt;/P&gt;&lt;P&gt;37&lt;/P&gt;&lt;P&gt;38&lt;/P&gt;&lt;P&gt;39&lt;/P&gt;&lt;P&gt;40&lt;/P&gt;&lt;P&gt;41&lt;/P&gt;&lt;P&gt;42&lt;/P&gt;&lt;P&gt;43&lt;/P&gt;&lt;P&gt;44&lt;/P&gt;&lt;P&gt;45&lt;/P&gt;&lt;P&gt;46&lt;/P&gt;&lt;P&gt;47&lt;/P&gt;&lt;P&gt;48&lt;/P&gt;&lt;P&gt;49&lt;/P&gt;&lt;P&gt;50&lt;/P&gt;&lt;P&gt;51&lt;/P&gt;&lt;P&gt;52&lt;/P&gt;&lt;P&gt;53&lt;/P&gt;&lt;P&gt;54&lt;/P&gt;&lt;P&gt;55&lt;/P&gt;&lt;P&gt;56&lt;/P&gt;&lt;P&gt;57&lt;/P&gt;&lt;P&gt;58&lt;/P&gt;&lt;P&gt;59&lt;/P&gt;&lt;P&gt;60&lt;/P&gt;&lt;P&gt;61&lt;/P&gt;&lt;P&gt;62&lt;/P&gt;&lt;P&gt;63&lt;/P&gt;&lt;P&gt;64&lt;/P&gt;&lt;P&gt;65&lt;/P&gt;&lt;P&gt;66&lt;/P&gt;&lt;P&gt;67&lt;/P&gt;&lt;P&gt;68&lt;/P&gt;&lt;P&gt;69&lt;/P&gt;&lt;P&gt;70&lt;/P&gt;&lt;P&gt;71&lt;/P&gt;&lt;P&gt;72&lt;/P&gt;&lt;P&gt;73&lt;/P&gt;&lt;P&gt;74&lt;/P&gt;&lt;P&gt;75&lt;/P&gt;&lt;P&gt;76&lt;/P&gt;&lt;P&gt;77&lt;/P&gt;&lt;P&gt;78&lt;/P&gt;&lt;P&gt;79&lt;/P&gt;&lt;P&gt;80&lt;/P&gt;&lt;P&gt;81&lt;/P&gt;&lt;P&gt;82&lt;/P&gt;&lt;P&gt;83&lt;/P&gt;&lt;P&gt;84&lt;/P&gt;&lt;P&gt;85&lt;/P&gt;&lt;P&gt;86&lt;/P&gt;&lt;P&gt;87&lt;/P&gt;&lt;P&gt;88&lt;/P&gt;&lt;P&gt;89&lt;/P&gt;&lt;P&gt;90&lt;/P&gt;&lt;P&gt;91&lt;/P&gt;&lt;P&gt;92&lt;/P&gt;&lt;P&gt;93&lt;/P&gt;&lt;P&gt;94&lt;/P&gt;&lt;P&gt;95&lt;/P&gt;&lt;P&gt;96&lt;/P&gt;&lt;P&gt;97&lt;/P&gt;&lt;P&gt;98&lt;/P&gt;&lt;P&gt;99&lt;/P&gt;&lt;P&gt;100&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Oct 2014 21:32:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/User-defined-informats/m-p/173955#M44788</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2014-10-07T21:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: User defined informats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/User-defined-informats/m-p/173956#M44789</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Chouchou, I am totally agreed with the point mentioned by Arthur.&amp;nbsp; Please try the below code and see if this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format;&lt;/P&gt;&lt;P&gt;&amp;nbsp; invalue convertc&lt;/P&gt;&lt;P&gt;&amp;nbsp; low - &amp;lt;65 = 1&lt;/P&gt;&lt;P&gt;&amp;nbsp; 65 - &amp;lt;75 = 2&lt;/P&gt;&lt;P&gt;&amp;nbsp; 75 - &amp;lt;85 = 3&lt;/P&gt;&lt;P&gt;&amp;nbsp; 85 - &amp;lt;100 = 4&lt;/P&gt;&lt;P&gt;&amp;nbsp; other = 5;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; value convertn&lt;/P&gt;&lt;P&gt;&amp;nbsp; low - &amp;lt;65 = "F"&lt;/P&gt;&lt;P&gt;&amp;nbsp; 65 -&amp;lt;75 = "C"&lt;/P&gt;&lt;P&gt;&amp;nbsp; 75 - &amp;lt;85 = "B"&lt;/P&gt;&lt;P&gt;&amp;nbsp; 85 - &amp;lt;100 = "A"&lt;/P&gt;&lt;P&gt;&amp;nbsp; other = "Not defined yet";&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; value convertx&lt;/P&gt;&lt;P&gt;&amp;nbsp; 1 = 'F'&lt;/P&gt;&lt;P&gt;&amp;nbsp; 2 = 'C'&lt;/P&gt;&lt;P&gt;&amp;nbsp; 3 = 'B'&lt;/P&gt;&lt;P&gt;&amp;nbsp; 4 = 'A'&lt;/P&gt;&lt;P&gt;&amp;nbsp; 5 = 'Not defined yet';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data aaa;&lt;/P&gt;&lt;P&gt;&amp;nbsp; length y $10 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; x = 0; y = '0'; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; x = 65; y = '65'; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; x = 72; y = '72'; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; x = 81; y = '81'; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; x = 88; y = '88'; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; x = 99; y = '99'; output; &lt;/P&gt;&lt;P&gt;&amp;nbsp; x = 100; y = '100'; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; x = 120; y = '120'; output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data bbb;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set aaa;&lt;/P&gt;&lt;P&gt;&amp;nbsp; zc = put(input(y, convertc.), convertx.);&lt;/P&gt;&lt;P&gt;&amp;nbsp; zn = put(x, convertn.);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Oct 2014 07:54:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/User-defined-informats/m-p/173956#M44789</guid>
      <dc:creator>AmitRathore</dc:creator>
      <dc:date>2014-10-08T07:54:59Z</dc:date>
    </item>
    <item>
      <title>Re: User defined informats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/User-defined-informats/m-p/173957#M44790</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi chouchou,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Others have shown that your INFORMAT is not OK for your purpose. I hope to show you what is happening behind the scenes by examples.&lt;/P&gt;&lt;P&gt;Your value ranges&lt;/P&gt;&lt;P&gt;0 - &amp;lt; 65 , ..... 85 - &amp;lt; 100&lt;/P&gt;&lt;P&gt;produce ERROR. Understanding the reason for this error will get you back to seeking other ways.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First let us stop this ERROR, by a small change in the first and last Range as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format;&lt;/P&gt;&lt;P&gt;invalue $conv&lt;/P&gt;&lt;P&gt;0.001 - &amp;lt; 65 = 'F'&lt;/P&gt;&lt;P&gt;65 -&amp;lt; 75 = 'C'&lt;/P&gt;&lt;P&gt;75 - &amp;lt; 85 = 'B'&lt;/P&gt;&lt;P&gt;85 -&amp;nbsp; 99.999 = 'A'&lt;/P&gt;&lt;P&gt;other = 'Not defined yet ';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this modification may not alter much of your specification. Run this and see that the ERROR is not there.&amp;nbsp; We will see later why this happened.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Next is, how you will read X - as numeric or character from the input file ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[1] Let X be numeric as in this input file:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;infile cards truncover;&lt;/P&gt;&lt;P&gt;*input x $3.;&lt;/P&gt;&lt;P&gt;input x;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;3&lt;/P&gt;&lt;P&gt;50&lt;/P&gt;&lt;P&gt;57&lt;/P&gt;&lt;P&gt;58&lt;/P&gt;&lt;P&gt;68&lt;/P&gt;&lt;P&gt;69&lt;/P&gt;&lt;P&gt;70&lt;/P&gt;&lt;P&gt;71&lt;/P&gt;&lt;P&gt;78&lt;/P&gt;&lt;P&gt;79&lt;/P&gt;&lt;P&gt;80&lt;/P&gt;&lt;P&gt;82&lt;/P&gt;&lt;P&gt;89&lt;/P&gt;&lt;P&gt;90&lt;/P&gt;&lt;P&gt;91&lt;/P&gt;&lt;P&gt;96&lt;/P&gt;&lt;P&gt;99&lt;/P&gt;&lt;P&gt;100&lt;/P&gt;&lt;P&gt;120&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now apply the INFORMAT on X as below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; x1 = input(x, $conv.);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See the output of the data set, WANT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print data = want;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All your X's are transformed to&amp;nbsp; 'Net defined yet' as only 'other' is applicable for all X's. Why, wait for some time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[2] Now let X be character Variable.&lt;/P&gt;&lt;P&gt;In the above input file, read X as $3 instead as number and run the following code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13.6000003814697px;"&gt;data want;&lt;/P&gt;&lt;P style="font-size: 13.6000003814697px;"&gt;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P style="font-size: 13.6000003814697px;"&gt;&amp;nbsp;&amp;nbsp; x1 = input(x, $conv.);&lt;/P&gt;&lt;P style="font-size: 13.6000003814697px;"&gt;run;&lt;/P&gt;&lt;P style="font-size: 13.6000003814697px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.6000003814697px;"&gt;and see the output of the data set WANT:&lt;/P&gt;&lt;P style="font-size: 13.6000003814697px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.6000003814697px;"&gt;proc print data = want;&lt;/P&gt;&lt;P style="font-size: 13.6000003814697px;"&gt;run;&lt;/P&gt;&lt;P style="font-size: 13.6000003814697px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.6000003814697px;"&gt;You will see that the LABELS are OK except for 100 and 120 where you are supposed to get 'Not defined yet'. The following show the reasons.&lt;/P&gt;&lt;P style="font-size: 13.6000003814697px;"&gt;&lt;/P&gt;&lt;P&gt;proc sort data = have out = havesort;&lt;/P&gt;&lt;P&gt;by x;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print data = havesort;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When X is a character variable, the sorted file shows the order as 1, 100, 120, 2, 3, 50, ...., 96, 99.&lt;/P&gt;&lt;P&gt;Therefore INFORMAT transforms 1 as F, 100 as F, 120 as F, 2 as F, ..., 58 as F, 68 as C and so on.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The lesson is that SAS treats numeric value ranges as character ranges (&lt;STRONG&gt;by default&lt;/STRONG&gt;) like '0' - &amp;lt; '65', ...., '85' - &amp;lt; '100' when&amp;nbsp; INVALUE statement (invalue $convert) is made.&lt;/P&gt;&lt;P&gt;So you can not achieve what you want by your $CONVERT Informat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now coming to another way of doing what you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Change X to Number in the Input File.&lt;/P&gt;&lt;P&gt;Use the following Format:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format;&lt;/P&gt;&lt;P&gt;value numconv&lt;/P&gt;&lt;P&gt;0 - &amp;lt; 65 = 'F'&lt;/P&gt;&lt;P&gt;65 -&amp;lt; 75 = 'C'&lt;/P&gt;&lt;P&gt;75 - &amp;lt; 85 = 'B'&lt;/P&gt;&lt;P&gt;85 -&amp;nbsp; &amp;lt;100 = 'A'&lt;/P&gt;&lt;P&gt;other = 'Not defined yet ';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now use the following code to transform X.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; x1 = put(x, numconv.);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print data = want;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: MUTHIA KACHIRAYAN&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Oct 2014 10:56:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/User-defined-informats/m-p/173957#M44790</guid>
      <dc:creator>KachiM</dc:creator>
      <dc:date>2014-10-08T10:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: User defined informats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/User-defined-informats/m-p/173958#M44791</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The whole struggle you're facing is caused by your variable being character and not numeric but you wanting to define ranges. I'm surprised that no one suggested yet to first convert your variable into numeric and then use a numeric format as there things are really simple.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format;&lt;/P&gt;&lt;P&gt;&amp;nbsp; value convert&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 - &amp;lt;65 = 'F'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 65 -&amp;lt;75 = 'C'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 75 - &amp;lt;85 = 'B'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 85 - 100 = 'A'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; other = 'Not defined yet ';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data sample;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input var :$3.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; want=put(input(var,best32.),convert.);&lt;/P&gt;&lt;P&gt;&amp;nbsp; datalines;&lt;/P&gt;&lt;P&gt;-1&lt;/P&gt;&lt;P&gt;0&lt;/P&gt;&lt;P&gt;9&lt;/P&gt;&lt;P&gt;10&lt;/P&gt;&lt;P&gt;74&lt;/P&gt;&lt;P&gt;75&lt;/P&gt;&lt;P&gt;76&lt;/P&gt;&lt;P&gt;99&lt;/P&gt;&lt;P&gt;100&lt;/P&gt;&lt;P&gt;101&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Defining ranges for a character format or informat works differently - and the same way like when comparing the values of two character variables. It basically compares the first character in the one variable with the first character in the second variable, then 2nd with 2nd, 3rd with 3rd ...and so on. What's smaller or greater depends on the collating sequence (and the collating sequence is partly dependent on the code page used). &lt;/P&gt;&lt;P&gt;&lt;A href="http://supportline.microfocus.com/Documentation/books/rd60/lhacha01.htm" title="http://supportline.microfocus.com/Documentation/books/rd60/lhacha01.htm"&gt;http://supportline.microfocus.com/Documentation/books/rd60/lhacha01.htm&amp;nbsp; &lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="active_link" href="http://support.sas.com/documentation/cdl/en/nlsref/61893/HTML/default/viewer.htm#a002613125.htm" title="http://support.sas.com/documentation/cdl/en/nlsref/61893/HTML/default/viewer.htm#a002613125.htm"&gt;SAS(R) 9.2 National Language Support (NLS): Reference Guide&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Even though you're defining a character informat SAS lets you write the strings without quotes as long as it's digits only. This is not really "clean" but SAS is generous and it's how it worked since long. That doesn't mean though that these digits are treated as numbers. They are not. They are treated as strings.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So now with&amp;nbsp; &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;85 - &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #ff0000; background-color: #ffffff;"&gt;100&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt; = 'A'&amp;nbsp;&amp;nbsp; it's still about strings and comparing the first character to the left with the first character to the right.&amp;nbsp; The '8' of 85 is higher up in the collating sequence than the '1' from 100. That's why you're getting the error here.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Run below code and then check the SAS log. May be that will help to explain how character comparison works.&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input @1 (str1 str2) (:$2.) @1 (num1 num2) (?? :8.);&lt;/P&gt;&lt;P&gt;&amp;nbsp; if str1 &amp;gt; str2 then put str1= '&amp;gt; ' str2=;&lt;/P&gt;&lt;P&gt;&amp;nbsp; else if str1 &amp;lt; str2 then put str1= '&amp;lt; ' str2=;&lt;/P&gt;&lt;P&gt;&amp;nbsp; else put str1= '= ' str2=;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if num1 &amp;gt; num2 then put num1= '&amp;gt; ' num2=;&lt;/P&gt;&lt;P&gt;&amp;nbsp; else if num1 &amp;lt; num2 then put num1= '&amp;lt; ' num2=;&lt;/P&gt;&lt;P&gt;&amp;nbsp; else put num1= '= ' num2=;&lt;/P&gt;&lt;P&gt;&amp;nbsp; put;&lt;/P&gt;&lt;P&gt;&amp;nbsp; datalines;&lt;/P&gt;&lt;P&gt;1 1&lt;/P&gt;&lt;P&gt;10 1&lt;/P&gt;&lt;P&gt;10 2&lt;/P&gt;&lt;P&gt;10 85&lt;/P&gt;&lt;P&gt;8 75&lt;/P&gt;&lt;P&gt;1 a&lt;/P&gt;&lt;P&gt;1 A&lt;/P&gt;&lt;P&gt;a a&lt;/P&gt;&lt;P&gt;A a&lt;/P&gt;&lt;P&gt;A b&lt;/P&gt;&lt;P&gt;A B&lt;/P&gt;&lt;P&gt;a b&lt;/P&gt;&lt;P&gt;A B&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Oct 2014 12:13:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/User-defined-informats/m-p/173958#M44791</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2014-10-08T12:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: User defined informats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/User-defined-informats/m-p/173959#M44792</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Patrick, I'm fully clear.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Oct 2014 15:52:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/User-defined-informats/m-p/173959#M44792</guid>
      <dc:creator>chouchou</dc:creator>
      <dc:date>2014-10-09T15:52:54Z</dc:date>
    </item>
  </channel>
</rss>

