<?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: Numeric collation with proc format and invalue? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Numeric-collation-with-proc-format-and-invalue/m-p/23121#M5083</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is no need to make a informate for you situation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data temp;
input gra $;
num_gra=input(gra, ?? best8.);
if num_gra lt 227 or num_gra gt 8165 or missing(num_gra) then num_gra=.U;
cards;
226
227
500
1000
8165
8165
8166
wioe
;
run;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: xia keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 30 Jun 2011 07:06:56 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2011-06-30T07:06:56Z</dc:date>
    <item>
      <title>Numeric collation with proc format and invalue?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Numeric-collation-with-proc-format-and-invalue/m-p/23119#M5081</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;I've been asked to input all of my data as character and use PROC FORMAT with INVALUE to create new vars as numeric.&amp;nbsp; Some of this data has large ranges and I'd like to use, for instance:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;invalue gramf&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'227' - '8165' = _same_&lt;/P&gt;&lt;P&gt;other = .U;&lt;/P&gt;&lt;P&gt;&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;But I'm getting an error message "ERROR: Start is greater than end: -." due to how character vars are sorted by SAS, I believe.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd also like to ensure code such as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;invalue weight&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'050' - '400' = _same_&lt;/P&gt;&lt;P&gt;other = .U;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;doesn't give unexpected results due to the collation issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've seen some info on NUMERIC_COLLATION but think it's only available for PROC SORT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&amp;nbsp; I think the best solution is to read the data in as numeric - but might have to find a work around.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jun 2011 01:02:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Numeric-collation-with-proc-format-and-invalue/m-p/23119#M5081</guid>
      <dc:creator>anjgupta</dc:creator>
      <dc:date>2011-06-30T01:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric collation with proc format and invalue?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Numeric-collation-with-proc-format-and-invalue/m-p/23120#M5082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;From what I understand you best read the values as numeric. Code like below could help:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; invalue gramf&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 227 - 8165 = _same_&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; other&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = .U&lt;BR /&gt;&amp;nbsp;&amp;nbsp; ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data test;&lt;BR /&gt;&amp;nbsp; input TestData gramf32.;&lt;BR /&gt;&amp;nbsp; format TestData best32.;&lt;BR /&gt;&amp;nbsp; datalines;&lt;BR /&gt;-40.5&lt;BR /&gt;0&lt;BR /&gt;226.9&lt;BR /&gt;227&lt;BR /&gt;500&lt;BR /&gt;1000.12345678&lt;BR /&gt;8165&lt;BR /&gt;8165.1&lt;BR /&gt;8166&lt;BR /&gt;.&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc print data=test;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;Patrick&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jun 2011 01:20:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Numeric-collation-with-proc-format-and-invalue/m-p/23120#M5082</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2011-06-30T01:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric collation with proc format and invalue?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Numeric-collation-with-proc-format-and-invalue/m-p/23121#M5083</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is no need to make a informate for you situation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data temp;
input gra $;
num_gra=input(gra, ?? best8.);
if num_gra lt 227 or num_gra gt 8165 or missing(num_gra) then num_gra=.U;
cards;
226
227
500
1000
8165
8165
8166
wioe
;
run;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: xia keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jun 2011 07:06:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Numeric-collation-with-proc-format-and-invalue/m-p/23121#M5083</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-06-30T07:06:56Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric collation with proc format and invalue?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Numeric-collation-with-proc-format-and-invalue/m-p/23122#M5084</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since the code examples you provide do not generate the error it would be helpful to either post the whole PROC FORMAT code or the section that is creating the error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What would be examples of unexpected results?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Jul 2011 15:21:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Numeric-collation-with-proc-format-and-invalue/m-p/23122#M5084</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2011-07-01T15:21:12Z</dc:date>
    </item>
  </channel>
</rss>

