<?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: How to define a value in &amp;quot;Between&amp;quot; statement by using PROC SQL? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-define-a-value-in-quot-Between-quot-statement-by-using/m-p/331398#M62732</link>
    <description>&lt;P&gt;Expanding on&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;'s reply:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
update work.test
set POOR=case
	when poor between 1 and 13 then 1
	when poor between 13 and 30 then 2 
	else . end;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 10 Feb 2017 04:37:51 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2017-02-10T04:37:51Z</dc:date>
    <item>
      <title>How to define a value in "Between" statement by using PROC SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-define-a-value-in-quot-Between-quot-statement-by-using/m-p/331342#M62718</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to define a column with "between" condition in PROC SQL? &amp;nbsp;I got an error message from the syntax. &amp;nbsp;Please advice. &amp;nbsp;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;705 PROC SQL;&lt;BR /&gt;706 update work.test&lt;BR /&gt;707 set&lt;/P&gt;&lt;P&gt;729 POOR=case when 1 =&amp;lt; POOR&amp;nbsp;&amp;lt; 14 then POOR=1&lt;BR /&gt;-&lt;BR /&gt;22&lt;BR /&gt;730 when 14 =&amp;lt; POOR =&amp;lt; 30 then POOR=2 end;&lt;BR /&gt;- -&lt;BR /&gt;22 22&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string,&lt;BR /&gt;a numeric constant, a datetime constant, a missing value, BTRIM, INPUT, PUT, SUBSTRING,&lt;BR /&gt;USER.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2017 21:35:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-define-a-value-in-quot-Between-quot-statement-by-using/m-p/331342#M62718</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2017-02-09T21:35:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to define a value in "Between" statement by using PROC SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-define-a-value-in-quot-Between-quot-statement-by-using/m-p/331344#M62719</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;case
  when poor between 1 and 13 then 1
  when poor between 14 and 30 then 2
end as poor&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 Feb 2017 21:42:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-define-a-value-in-quot-Between-quot-statement-by-using/m-p/331344#M62719</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-02-09T21:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to define a value in "Between" statement by using PROC SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-define-a-value-in-quot-Between-quot-statement-by-using/m-p/331346#M62720</link>
      <description>&lt;P&gt;I think the first is not accurate enough, what happen if the poor=13.5? &amp;nbsp;Will the data be assign to null?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2017 21:55:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-define-a-value-in-quot-Between-quot-statement-by-using/m-p/331346#M62720</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2017-02-09T21:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to define a value in "Between" statement by using PROC SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-define-a-value-in-quot-Between-quot-statement-by-using/m-p/331349#M62721</link>
      <description>Change to 13 in the second when clause.</description>
      <pubDate>Thu, 09 Feb 2017 22:01:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-define-a-value-in-quot-Between-quot-statement-by-using/m-p/331349#M62721</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2017-02-09T22:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to define a value in "Between" statement by using PROC SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-define-a-value-in-quot-Between-quot-statement-by-using/m-p/331360#M62722</link>
      <description>&lt;P&gt;The 1st condition is&amp;nbsp;&lt;STRONG&gt;1&lt;/STRONG&gt; =&amp;lt; Poor &amp;lt; &lt;STRONG&gt;14 which is not including&amp;nbsp;14. &amp;nbsp; The 2nd condition is&amp;nbsp;14 =&amp;lt; Poor =&amp;lt; 30 which is including 14. &amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2017 22:31:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-define-a-value-in-quot-Between-quot-statement-by-using/m-p/331360#M62722</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2017-02-09T22:31:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to define a value in "Between" statement by using PROC SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-define-a-value-in-quot-Between-quot-statement-by-using/m-p/331368#M62723</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt;&amp;nbsp;Between is inclusive so you can't use it. But there's no reason you cant compound the conditions.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Case&lt;/P&gt;
&lt;P&gt;when x &amp;gt; = 4 And x &amp;lt; 20 then 1&lt;/P&gt;
&lt;P&gt;when x &amp;gt;= 20 and x &amp;lt; 40 then 2&lt;/P&gt;
&lt;P&gt;end AS new_variable&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Change the intervals to what you need, this is an exmple.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2017 23:05:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-define-a-value-in-quot-Between-quot-statement-by-using/m-p/331368#M62723</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-02-09T23:05:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to define a value in "Between" statement by using PROC SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-define-a-value-in-quot-Between-quot-statement-by-using/m-p/331371#M62724</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;The 1st condition is&amp;nbsp;&lt;STRONG&gt;1&lt;/STRONG&gt; =&amp;lt; Poor &amp;lt; &lt;STRONG&gt;14 which is not including&amp;nbsp;14. &amp;nbsp; The 2nd condition is&amp;nbsp;14 =&amp;lt; Poor =&amp;lt; 30 which is including 14. &amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Does your age have fractional values, ie 13.8? If so then you should mention that. You have not provided and example data in a useable form.&lt;/P&gt;
&lt;P&gt;Also you should post logs with error messages into a code box using the {i} menu item that appears at the top of the entry box to maintain formating.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that for most purposes you can use a FORMAT to group data for analysis and display.&lt;/P&gt;
&lt;P&gt;Consider:&lt;/P&gt;
&lt;PRE&gt;proc format library=work;
value poorgrp
0 -&amp;lt;14 ='1'
14 - 30='2';
run;

proc print data=work.test;
   var poor;
   format poor poorgrp.;
run;&lt;/PRE&gt;
&lt;P&gt;I have literally hundreds of formats like that between my different projects.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or use other text to display some different meaning&lt;/P&gt;
&lt;PRE&gt;proc format library=work;
value poorothergrp
0 -&amp;lt;14 ='Top'
14 - 30='Bottom';
run;&lt;/PRE&gt;
&lt;P&gt;So I get a different display without changing any values for variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For instance I have data with ages. For some projects the analysis is based on specific ranges of ages 18-30, 31-64, 65+, or 5 and 10 year increments. I do not create additional variables but use the formatted value to create columns/rows with suitable text as column or row headings. If I use the format in a cross tab then the formatted values are used for binning.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2017 23:11:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-define-a-value-in-quot-Between-quot-statement-by-using/m-p/331371#M62724</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-02-09T23:11:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to define a value in "Between" statement by using PROC SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-define-a-value-in-quot-Between-quot-statement-by-using/m-p/331398#M62732</link>
      <description>&lt;P&gt;Expanding on&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;'s reply:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
update work.test
set POOR=case
	when poor between 1 and 13 then 1
	when poor between 13 and 30 then 2 
	else . end;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 Feb 2017 04:37:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-define-a-value-in-quot-Between-quot-statement-by-using/m-p/331398#M62732</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-02-10T04:37:51Z</dc:date>
    </item>
  </channel>
</rss>

