<?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: Help needed with outputting data using Data Step in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Help-needed-with-outputting-data-using-Data-Step/m-p/383753#M277071</link>
    <description>&lt;P&gt;You're conditions are stacked, like they have an AND. It looks like you want OR instead, if any is one then outout?&lt;/P&gt;
&lt;P&gt;If so, you can simplify this by checking if the sum of the values are greater than or equal to 1.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if sum(first_check, second_check, .. , fifth_check) &amp;gt;= 1 then output;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 28 Jul 2017 15:22:28 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-07-28T15:22:28Z</dc:date>
    <item>
      <title>Help needed with outputting data using Data Step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-needed-with-outputting-data-using-Data-Step/m-p/383739#M277070</link>
      <description>&lt;P&gt;Here I have a bunch of Checks to output if they equal 1. Each check that is equal to 0 should be ignored.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the current code I have for the output:&lt;/P&gt;&lt;PRE&gt;Data ouput_file;
    Set input_file;
    If first_check = 1;
       If second_check = 1;
          If third_check = 1;
             If fourth_check = 1;
                 If fifth_check = 1 then output;
Run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At the moment, the code only works assuming that first_check = 1. The problem I am facing is that if first_check = 0, the code won't run. If first_check = 0, I still want it to ouput the other checks if they are equal to 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I get it to run for all checks when they are&amp;nbsp;equal to&amp;nbsp;1&amp;nbsp;assuming any check (i.e the first or second)&amp;nbsp;can be&amp;nbsp;0?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jul 2017 15:05:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-needed-with-outputting-data-using-Data-Step/m-p/383739#M277070</guid>
      <dc:creator>jos283</dc:creator>
      <dc:date>2017-07-28T15:05:43Z</dc:date>
    </item>
    <item>
      <title>Re: Help needed with outputting data using Data Step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-needed-with-outputting-data-using-Data-Step/m-p/383753#M277071</link>
      <description>&lt;P&gt;You're conditions are stacked, like they have an AND. It looks like you want OR instead, if any is one then outout?&lt;/P&gt;
&lt;P&gt;If so, you can simplify this by checking if the sum of the values are greater than or equal to 1.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if sum(first_check, second_check, .. , fifth_check) &amp;gt;= 1 then output;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 28 Jul 2017 15:22:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-needed-with-outputting-data-using-Data-Step/m-p/383753#M277071</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-07-28T15:22:28Z</dc:date>
    </item>
    <item>
      <title>Re: Help needed with outputting data using Data Step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-needed-with-outputting-data-using-Data-Step/m-p/384043#M277072</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/153356"&gt;@jos283&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;The syntax (sub-setting IFs) you've used translate logically into AND. What you're after is OR.&lt;/P&gt;
&lt;P&gt;If you're variables numeric and flags (0/1) then the logic&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;posted will work; else use something as below:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ouput_file;
  set input_file;
  if 
    first_check = 1 
    or second_check = 1 
    or third_check = 1 
    or fourth_check = 1 
    or fifth_check = 1 
    then output;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 30 Jul 2017 01:12:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-needed-with-outputting-data-using-Data-Step/m-p/384043#M277072</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-07-30T01:12:48Z</dc:date>
    </item>
  </channel>
</rss>

