<?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: Creating a Range Format from a Dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-Range-Format-from-a-Dataset/m-p/303570#M64509</link>
    <description>&lt;P&gt;You can use LOW and HIGH to represent below and above respectively, as this code demonstrates:&lt;/P&gt;
&lt;PRE&gt;proc format cntlout=temp;
  value test
    low-1=23
    2-5=45
    6-high=99;
run;
&lt;/PRE&gt;
&lt;P&gt;The dataset temp will show the output.&lt;/P&gt;</description>
    <pubDate>Mon, 10 Oct 2016 15:14:24 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2016-10-10T15:14:24Z</dc:date>
    <item>
      <title>Creating a Range Format from a Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-Range-Format-from-a-Dataset/m-p/303565#M64506</link>
      <description>&lt;P&gt;Hi, I have this lookup table (range), which I intend to use as a format for another table (have).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data range;&lt;BR /&gt;input low high desc $8.;&lt;BR /&gt;cards;&lt;BR /&gt;-999999 1 Low&lt;BR /&gt;2 3 Medium&lt;BR /&gt;4 999999 High&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data have;&lt;BR /&gt;input num;&lt;BR /&gt;cards;&lt;BR /&gt;-1&lt;BR /&gt;0&lt;BR /&gt;5&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'd also prefer for the low range, to include all values &amp;lt;= 1, and the high range to include all values &amp;gt; 4.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How is this possible?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2016 15:09:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-Range-Format-from-a-Dataset/m-p/303565#M64506</guid>
      <dc:creator>angeliquec</dc:creator>
      <dc:date>2016-10-10T15:09:51Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a Range Format from a Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-Range-Format-from-a-Dataset/m-p/303570#M64509</link>
      <description>&lt;P&gt;You can use LOW and HIGH to represent below and above respectively, as this code demonstrates:&lt;/P&gt;
&lt;PRE&gt;proc format cntlout=temp;
  value test
    low-1=23
    2-5=45
    6-high=99;
run;
&lt;/PRE&gt;
&lt;P&gt;The dataset temp will show the output.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2016 15:14:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-Range-Format-from-a-Dataset/m-p/303570#M64509</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-10-10T15:14:24Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a Range Format from a Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-Range-Format-from-a-Dataset/m-p/303575#M64511</link>
      <description>&lt;P&gt;Here are changes to make, for this to be suitable for creating a format:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data range;&lt;BR /&gt;input start end label $8.;&lt;/P&gt;
&lt;P&gt;if label='Low' then HLO='L';&lt;/P&gt;
&lt;P&gt;else if label='High' then HLO='H';&lt;/P&gt;
&lt;P&gt;fmtname='Range';&lt;BR /&gt;cards;&lt;BR /&gt;-999999 1 Low&lt;BR /&gt;2 3 Medium&lt;BR /&gt;4 999999 High&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you can create a format using:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc format cntlin=range;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And you can use the format when processing HAVE, by adding:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;format num range.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A few notes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;The variable names have been changed.&amp;nbsp; START, END, LABEL, and FMTNAME are required names.&lt;/LI&gt;
&lt;LI&gt;Note that you have gaps here, for non-integer values.&lt;/LI&gt;
&lt;LI&gt;When HLO="L", that tells PROC FORMAT to ignore the START value, and consider "Low" to be the start of the range.&lt;/LI&gt;
&lt;LI&gt;Similarly, when HLO="H", that tells PROC FORMAT to ignore the END value, and consider "High" to be end of the range.&lt;/LI&gt;
&lt;LI&gt;The name of the format (range.) comes from the FMTNAME variable, not from the name of the CNTLIN= data set.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2016 15:25:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-Range-Format-from-a-Dataset/m-p/303575#M64511</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-10-10T15:25:56Z</dc:date>
    </item>
  </channel>
</rss>

