<?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: Can I use this SAS code: if  120 &amp;lt;= Systolic_BP0 &amp;lt; 130 then BP_group = 1; in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Can-I-use-this-SAS-code-if-120-lt-Systolic-BP0-lt-130-then-BP/m-p/974785#M377985</link>
    <description>&lt;P&gt;You have been given poor advice.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps they are used to programming in other languages that do not support the abbreviated syntax of&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;expression operator expression operator expression ....&lt;/PRE&gt;
&lt;P&gt;that SAS supports.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The &lt;A href="https://documentation.sas.com/doc/en/lrcon/9.4/p00iah2thp63bmn1lt20esag14lh.htm" target="_self"&gt;documentation&lt;/A&gt; calls it an implied AND.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P class="xisDoc-paragraph"&gt;Two comparisons with a common variable linked by AND can be condensed with an implied AND. For example, the following two subsetting IF statements produce the same result:&lt;/P&gt;
&lt;UL class="xisDoc-listUnordered"&gt;
&lt;LI class="xisDoc-item"&gt;&lt;CODE class="xisDoc-inlineCode"&gt;if 16&amp;lt;=age and age&amp;lt;=65;&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI class="xisDoc-item"&gt;&lt;CODE class="xisDoc-inlineCode"&gt;if 16&amp;lt;=age&amp;lt;=65;&lt;/CODE&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To see what it means use it in a WHERE statement&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input Systolic_BP0 @@;
cards;
100 120 121 129 130 131 . 
;

data want;
 set have;
 where 120 &amp;lt;= Systolic_BP0 &amp;lt; 130 ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and then check the SAS log for the note that shows&amp;nbsp;what SAS transformed it into.&lt;/P&gt;
&lt;PRE&gt;NOTE: There were 3 observations read from the data set WORK.HAVE.
      WHERE (Systolic_BP0&amp;gt;=120 and Systolic_BP0&amp;lt;130);
NOTE: The data set WORK.WANT has 3 observations and 1 variables.
&lt;/PRE&gt;
&lt;P&gt;Note you are not limited to just a single "implied AND" in an expression.&lt;/P&gt;
&lt;PRE&gt;54   data want;
55    set sashelp.class;
56    where age &amp;lt; weight &amp;lt; height &amp;gt; 5;
57   run;

NOTE: There were 1 observations read from the data set SASHELP.CLASS.
      WHERE (age&amp;lt;weight) and (weight&amp;lt;height) and (height&amp;gt;5);
NOTE: The data set WORK.WANT has 1 observations and 5 variables.
&lt;/PRE&gt;</description>
    <pubDate>Thu, 11 Sep 2025 03:04:05 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2025-09-11T03:04:05Z</dc:date>
    <item>
      <title>Can I use this SAS code: if  120 &lt;= Systolic_BP0 &lt; 130 then BP_group = 1;</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-use-this-SAS-code-if-120-lt-Systolic-BP0-lt-130-then-BP/m-p/974783#M377984</link>
      <description>&lt;P&gt;I have been using this code to create a new group variable, and someone said this code won't work.&amp;nbsp; &amp;nbsp;The code should be&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if (Systolic_BP0 &amp;gt;= 120 and Systolic_BP0 &amp;lt; 130) then BP_group = 1;&lt;/P&gt;
&lt;P&gt;Is this true?&amp;nbsp; &amp;nbsp; Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 11 Sep 2025 00:31:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-use-this-SAS-code-if-120-lt-Systolic-BP0-lt-130-then-BP/m-p/974783#M377984</guid>
      <dc:creator>J_Park</dc:creator>
      <dc:date>2025-09-11T00:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use this SAS code: if  120 &lt;= Systolic_BP0 &lt; 130 then BP_group = 1;</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-use-this-SAS-code-if-120-lt-Systolic-BP0-lt-130-then-BP/m-p/974785#M377985</link>
      <description>&lt;P&gt;You have been given poor advice.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps they are used to programming in other languages that do not support the abbreviated syntax of&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;expression operator expression operator expression ....&lt;/PRE&gt;
&lt;P&gt;that SAS supports.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The &lt;A href="https://documentation.sas.com/doc/en/lrcon/9.4/p00iah2thp63bmn1lt20esag14lh.htm" target="_self"&gt;documentation&lt;/A&gt; calls it an implied AND.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P class="xisDoc-paragraph"&gt;Two comparisons with a common variable linked by AND can be condensed with an implied AND. For example, the following two subsetting IF statements produce the same result:&lt;/P&gt;
&lt;UL class="xisDoc-listUnordered"&gt;
&lt;LI class="xisDoc-item"&gt;&lt;CODE class="xisDoc-inlineCode"&gt;if 16&amp;lt;=age and age&amp;lt;=65;&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI class="xisDoc-item"&gt;&lt;CODE class="xisDoc-inlineCode"&gt;if 16&amp;lt;=age&amp;lt;=65;&lt;/CODE&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To see what it means use it in a WHERE statement&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input Systolic_BP0 @@;
cards;
100 120 121 129 130 131 . 
;

data want;
 set have;
 where 120 &amp;lt;= Systolic_BP0 &amp;lt; 130 ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and then check the SAS log for the note that shows&amp;nbsp;what SAS transformed it into.&lt;/P&gt;
&lt;PRE&gt;NOTE: There were 3 observations read from the data set WORK.HAVE.
      WHERE (Systolic_BP0&amp;gt;=120 and Systolic_BP0&amp;lt;130);
NOTE: The data set WORK.WANT has 3 observations and 1 variables.
&lt;/PRE&gt;
&lt;P&gt;Note you are not limited to just a single "implied AND" in an expression.&lt;/P&gt;
&lt;PRE&gt;54   data want;
55    set sashelp.class;
56    where age &amp;lt; weight &amp;lt; height &amp;gt; 5;
57   run;

NOTE: There were 1 observations read from the data set SASHELP.CLASS.
      WHERE (age&amp;lt;weight) and (weight&amp;lt;height) and (height&amp;gt;5);
NOTE: The data set WORK.WANT has 1 observations and 5 variables.
&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Sep 2025 03:04:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-use-this-SAS-code-if-120-lt-Systolic-BP0-lt-130-then-BP/m-p/974785#M377985</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-09-11T03:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use this SAS code: if  120 &lt;= Systolic_BP0 &lt; 130 then BP_group = 1;</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-use-this-SAS-code-if-120-lt-Systolic-BP0-lt-130-then-BP/m-p/974789#M377986</link>
      <description>Thank you so much for confirming that the code I have been using is correct!</description>
      <pubDate>Thu, 11 Sep 2025 03:52:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-use-this-SAS-code-if-120-lt-Systolic-BP0-lt-130-then-BP/m-p/974789#M377986</guid>
      <dc:creator>J_Park</dc:creator>
      <dc:date>2025-09-11T03:52:51Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use this SAS code: if  120 &lt;= Systolic_BP0 &lt; 130 then BP_group = 1;</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-use-this-SAS-code-if-120-lt-Systolic-BP0-lt-130-then-BP/m-p/974875#M377990</link>
      <description>&lt;P&gt;If bp_group is to be a Boolean value (yes/no), you can shorten it to&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;bp_group = (120 &amp;lt;= Systolic_BP0 &amp;lt; 130);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Sep 2025 19:24:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-use-this-SAS-code-if-120-lt-Systolic-BP0-lt-130-then-BP/m-p/974875#M377990</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2025-09-11T19:24:37Z</dc:date>
    </item>
  </channel>
</rss>

