<?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: Where statement in proc print in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Where-statement-in-proc-print/m-p/562601#M157618</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/236266"&gt;@ChuksManuel&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello programmers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I believe this is a minor problem but i can't seem to get my head around it.&lt;/P&gt;
&lt;P&gt;I obtained a count from an array and i am trying to use the where statement in the proc print to print only observations with a count of atleast 1 (count is atleast 1 if the patient weighs 230lb).&lt;/P&gt;
&lt;P&gt;Here are my codes:&lt;/P&gt;
&lt;P&gt;data four; set one;&lt;BR /&gt;array weight wt1-wt10;&lt;BR /&gt;count=0;&lt;BR /&gt;do over weight;&lt;BR /&gt;if weight gt 230 then count = count +1;&lt;BR /&gt;end;&lt;BR /&gt;proc print; var school wt1-wt10;&lt;BR /&gt;where wt1=1 and wt2=1 and wt3=1 and wt4=1 and wt5=1 and wt6=1 and wt7=1 and wt8=1 and wt9=1 and wt10=1;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The first part of the code&amp;nbsp; ran but for some reasons, i can't get to print what i specified using proc print.&lt;/P&gt;
&lt;P&gt;Any help will be appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Show example data and the LOG when you run the proc print. I suspect you get a message&amp;nbsp;:&lt;/P&gt;
&lt;PRE&gt;NOTE: No observations were selected from data set
&lt;/PRE&gt;
&lt;P&gt;Since proc print does not do summaries then it is very likely that no single record meets all of those requirements.&lt;/P&gt;
&lt;P&gt;Perhaps try OR instead of AND on your where statement. But without example data it is hard to see what you might actually want to do.&lt;/P&gt;
&lt;P&gt;Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;</description>
    <pubDate>Thu, 30 May 2019 15:50:10 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-05-30T15:50:10Z</dc:date>
    <item>
      <title>Where statement in proc print</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-statement-in-proc-print/m-p/562597#M157616</link>
      <description>&lt;P&gt;Hello programmers,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I believe this is a minor problem but i can't seem to get my head around it.&lt;/P&gt;&lt;P&gt;I obtained a count from an array and i am trying to use the where statement in the proc print to print only observations with a count of atleast 1 (count is atleast 1 if the patient weighs 230lb).&lt;/P&gt;&lt;P&gt;Here are my codes:&lt;/P&gt;&lt;P&gt;data four; set one;&lt;BR /&gt;array weight wt1-wt10;&lt;BR /&gt;count=0;&lt;BR /&gt;do over weight;&lt;BR /&gt;if weight gt 230 then count = count +1;&lt;BR /&gt;end;&lt;BR /&gt;proc print; var school wt1-wt10;&lt;BR /&gt;where wt1=1 and wt2=1 and wt3=1 and wt4=1 and wt5=1 and wt6=1 and wt7=1 and wt8=1 and wt9=1 and wt10=1;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The first part of the code&amp;nbsp; ran but for some reasons, i can't get to print what i specified using proc print.&lt;/P&gt;&lt;P&gt;Any help will be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2019 15:42:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-statement-in-proc-print/m-p/562597#M157616</guid>
      <dc:creator>ChuksManuel</dc:creator>
      <dc:date>2019-05-30T15:42:42Z</dc:date>
    </item>
    <item>
      <title>Re: Where statement in proc print</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-statement-in-proc-print/m-p/562601#M157618</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/236266"&gt;@ChuksManuel&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello programmers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I believe this is a minor problem but i can't seem to get my head around it.&lt;/P&gt;
&lt;P&gt;I obtained a count from an array and i am trying to use the where statement in the proc print to print only observations with a count of atleast 1 (count is atleast 1 if the patient weighs 230lb).&lt;/P&gt;
&lt;P&gt;Here are my codes:&lt;/P&gt;
&lt;P&gt;data four; set one;&lt;BR /&gt;array weight wt1-wt10;&lt;BR /&gt;count=0;&lt;BR /&gt;do over weight;&lt;BR /&gt;if weight gt 230 then count = count +1;&lt;BR /&gt;end;&lt;BR /&gt;proc print; var school wt1-wt10;&lt;BR /&gt;where wt1=1 and wt2=1 and wt3=1 and wt4=1 and wt5=1 and wt6=1 and wt7=1 and wt8=1 and wt9=1 and wt10=1;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The first part of the code&amp;nbsp; ran but for some reasons, i can't get to print what i specified using proc print.&lt;/P&gt;
&lt;P&gt;Any help will be appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Show example data and the LOG when you run the proc print. I suspect you get a message&amp;nbsp;:&lt;/P&gt;
&lt;PRE&gt;NOTE: No observations were selected from data set
&lt;/PRE&gt;
&lt;P&gt;Since proc print does not do summaries then it is very likely that no single record meets all of those requirements.&lt;/P&gt;
&lt;P&gt;Perhaps try OR instead of AND on your where statement. But without example data it is hard to see what you might actually want to do.&lt;/P&gt;
&lt;P&gt;Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2019 15:50:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-statement-in-proc-print/m-p/562601#M157618</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-05-30T15:50:10Z</dc:date>
    </item>
    <item>
      <title>Re: Where statement in proc print</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-statement-in-proc-print/m-p/562602#M157619</link>
      <description>&lt;P&gt;Seems to me like this is what you want&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print; var school wt1-wt10;
where count ge 1;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 May 2019 15:51:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-statement-in-proc-print/m-p/562602#M157619</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-05-30T15:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: Where statement in proc print</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-statement-in-proc-print/m-p/562606#M157620</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;I obtained a count from an array and i am trying to use the where statement in the proc print to &lt;FONT color="#FF6600"&gt;&lt;STRONG&gt;print only observations with a count of at least 1&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;If this is what you want why are you filtering on the WT variables and not the COUNT variable? I think this a logic issue.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In the previous step tou're checking if WT1-WT10 is greater than 230 and I'm guessing that value will never be set to 1 because a weight of 1 isn't really possible.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I think this is what you want.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=four;
var school wt1-wt10;
where count&amp;gt;1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/236266"&gt;@ChuksManuel&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello programmers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I believe this is a minor problem but i can't seem to get my head around it.&lt;/P&gt;
&lt;P&gt;I obtained a count from an array and i am trying to use the where statement in the proc print to print only observations with a count of atleast 1 (count is atleast 1 if the patient weighs 230lb).&lt;/P&gt;
&lt;P&gt;Here are my codes:&lt;/P&gt;
&lt;P&gt;data four; set one;&lt;BR /&gt;array weight wt1-wt10;&lt;BR /&gt;count=0;&lt;BR /&gt;do over weight;&lt;BR /&gt;if weight gt 230 then count = count +1;&lt;BR /&gt;end;&lt;BR /&gt;proc print; var school wt1-wt10;&lt;BR /&gt;where wt1=1 and wt2=1 and wt3=1 and wt4=1 and wt5=1 and wt6=1 and wt7=1 and wt8=1 and wt9=1 and wt10=1;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The first part of the code&amp;nbsp; ran but for some reasons, i can't get to print what i specified using proc print.&lt;/P&gt;
&lt;P&gt;Any help will be appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2019 16:00:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-statement-in-proc-print/m-p/562606#M157620</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-05-30T16:00:17Z</dc:date>
    </item>
  </channel>
</rss>

