<?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 PROC FORMAT - Categorizing a continuous measure in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/PROC-FORMAT-Categorizing-a-continuous-measure/m-p/814486#M34168</link>
    <description>&lt;P&gt;How do I capture all values of a continuous measure&amp;nbsp;using formats?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example: yrs_monthly_use = 5.3 (5.3 years of monthly use)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;VALUE 
	yrs_monthly_usefmt
			low-&amp;lt;5 = "&amp;lt; 5 yrs"
			5-10 = "5-10 yrs"
			10-high = "&amp;gt; 10 yrs";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With the syntax above, 5.3 will end up in the 2nd category. Great.&lt;/P&gt;
&lt;P&gt;Where does 10 end up? Also, in the 2nd category?&lt;/P&gt;
&lt;P&gt;How do I modify the syntax so that the third category captures any value greater than 10?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried the following, but the label for the 2nd category becomes "5-10 yrs &lt;FONT color="#FF0000"&gt;&amp;gt;&lt;/FONT&gt;":&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	yrs_monthly_usefmt
			low-&amp;lt;5 = "&amp;lt; 5 yrs"
			5-10 = "5-10 yrs"
			&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;&amp;gt;&lt;/STRONG&gt;&lt;/FONT&gt;10-high = "&amp;gt; 10 yrs";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Fri, 20 May 2022 20:44:36 GMT</pubDate>
    <dc:creator>_maldini_</dc:creator>
    <dc:date>2022-05-20T20:44:36Z</dc:date>
    <item>
      <title>PROC FORMAT - Categorizing a continuous measure</title>
      <link>https://communities.sas.com/t5/New-SAS-User/PROC-FORMAT-Categorizing-a-continuous-measure/m-p/814486#M34168</link>
      <description>&lt;P&gt;How do I capture all values of a continuous measure&amp;nbsp;using formats?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example: yrs_monthly_use = 5.3 (5.3 years of monthly use)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;VALUE 
	yrs_monthly_usefmt
			low-&amp;lt;5 = "&amp;lt; 5 yrs"
			5-10 = "5-10 yrs"
			10-high = "&amp;gt; 10 yrs";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With the syntax above, 5.3 will end up in the 2nd category. Great.&lt;/P&gt;
&lt;P&gt;Where does 10 end up? Also, in the 2nd category?&lt;/P&gt;
&lt;P&gt;How do I modify the syntax so that the third category captures any value greater than 10?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried the following, but the label for the 2nd category becomes "5-10 yrs &lt;FONT color="#FF0000"&gt;&amp;gt;&lt;/FONT&gt;":&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	yrs_monthly_usefmt
			low-&amp;lt;5 = "&amp;lt; 5 yrs"
			5-10 = "5-10 yrs"
			&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;&amp;gt;&lt;/STRONG&gt;&lt;/FONT&gt;10-high = "&amp;gt; 10 yrs";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2022 20:44:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/PROC-FORMAT-Categorizing-a-continuous-measure/m-p/814486#M34168</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2022-05-20T20:44:36Z</dc:date>
    </item>
    <item>
      <title>Re: PROC FORMAT - Categorizing a continuous measure</title>
      <link>https://communities.sas.com/t5/New-SAS-User/PROC-FORMAT-Categorizing-a-continuous-measure/m-p/814488#M34169</link>
      <description>&lt;P&gt;The extra &amp;gt; comes from the "&amp;gt;10-high" portion, not the specification of the range.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have the somewhat right idea, but you need to include the &amp;lt;&amp;nbsp; symbol in between the values and it means include the end points.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
values	yrs_monthly_usefmt
			low-&amp;lt;5 = "&amp;lt; 5 yrs"
			5-&amp;lt;10 = "5-10 yrs"
			10-high = "&amp;gt; 10 yrs";
			
run;

data demo;
do i=0 to 12 by 0.5;
month = put(i, yrs_monthly_usefmt.);
output;
end;
run;

proc print data=demo;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I believe by default the end point is included in the interval. But you can modify that with the &amp;lt; symbol. Try playing around with including it inside the ranges.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is a good one to test for example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value	yrs_monthly_usefmt
			low-&amp;lt;5 = "&amp;lt; 5 yrs"
			5&amp;lt;-&amp;lt;10 = "5-10 yrs"
			10-high = "&amp;gt; 10 yrs";
			
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;5 doesn't get included in any range here, so it doesn't get formatted at all &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/36911"&gt;@_maldini_&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;How do I capture all values of a continuous measure&amp;nbsp;using formats?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example: yrs_monthly_use = 5.3 (5.3 years of monthly use)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;VALUE 
	yrs_monthly_usefmt
			low-&amp;lt;5 = "&amp;lt; 5 yrs"
			5-10 = "5-10 yrs"
			10-high = "&amp;gt; 10 yrs";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With the syntax above, 5.3 will end up in the 2nd category. Great.&lt;/P&gt;
&lt;P&gt;Where does 10 end up? Also, in the 2nd category?&lt;/P&gt;
&lt;P&gt;How do I modify the syntax so that the third category captures any value greater than 10?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried the following, but the label for the 2nd category becomes "5-10 yrs &lt;FONT color="#FF0000"&gt;&amp;gt;&lt;/FONT&gt;":&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	yrs_monthly_usefmt
			low-&amp;lt;5 = "&amp;lt; 5 yrs"
			5-10 = "5-10 yrs"
			&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;&amp;gt;&lt;/STRONG&gt;&lt;/FONT&gt;10-high = "&amp;gt; 10 yrs";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-SPOILER&gt;This is the format you want most likely:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;proc format;&lt;BR /&gt;value yrs_monthly_usefmt&lt;BR /&gt;low-&amp;lt;5 = "&amp;lt; 5 yrs"&lt;BR /&gt;5-10 = "5-10 yrs"&lt;BR /&gt;10&amp;lt;-high = "&amp;gt; 10 yrs";&lt;BR /&gt;&lt;BR /&gt;run;&lt;/LI-SPOILER&gt;</description>
      <pubDate>Fri, 20 May 2022 21:02:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/PROC-FORMAT-Categorizing-a-continuous-measure/m-p/814488#M34169</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-05-20T21:02:29Z</dc:date>
    </item>
    <item>
      <title>Re: PROC FORMAT - Categorizing a continuous measure</title>
      <link>https://communities.sas.com/t5/New-SAS-User/PROC-FORMAT-Categorizing-a-continuous-measure/m-p/814490#M34170</link>
      <description>&lt;P&gt;It is not hard to run a little test to see what it does.&lt;/P&gt;
&lt;PRE&gt;1733  data _null_;
1734    do yrs=1,5,7,10,12 ;
1735      put yrs= yrs yrs.;
1736    end;
1737  run;

yrs=1 &amp;lt; 5 yrs
yrs=5 5-10 yrs
yrs=7 5-10 yrs
yrs=10 5-10 yrs
yrs=12 &amp;gt; 10 yrs
&lt;/PRE&gt;
&lt;P&gt;If you want to exclude one of the boundaries from a range place a &amp;lt; on that side of the hyphen.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
  VALUE yrs
    low-&amp;lt;5 = "&amp;lt; 5 yrs"
    5-&amp;lt;10 = "5-10 yrs"
    10-high = "10+ yrs"
  ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result&lt;/P&gt;
&lt;PRE&gt;1745  data _null_;
1746    do yrs=1,5,7,10,12 ;
1747      put yrs= yrs yrs.;
1748    end;
1749  run;

yrs=1 &amp;lt; 5 yrs
yrs=5 5-10 yrs
yrs=7 5-10 yrs
yrs=10 10+ yrs
yrs=12 10+ yrs
&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 May 2022 21:12:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/PROC-FORMAT-Categorizing-a-continuous-measure/m-p/814490#M34170</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-05-20T21:12:16Z</dc:date>
    </item>
  </channel>
</rss>

