<?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: Exectue code if statement = true in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Exectue-code-if-statement-true/m-p/347511#M80288</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can name multiple data sets in the data statement and output them conditionally based on the value of your Combined variable;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Something like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data combo ic_only ec_only;   
 set current_ic current_ec;   
 if combined = 'Both' then output combo;   
 else if combined = 'IC' then output ic_only;   
 else if combined = 'EC' then output ec_only;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 05 Apr 2017 20:51:28 GMT</pubDate>
    <dc:creator>collinelliot</dc:creator>
    <dc:date>2017-04-05T20:51:28Z</dc:date>
    <item>
      <title>Exectue code if statement = true</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exectue-code-if-statement-true/m-p/347506#M80285</link>
      <description>&lt;P&gt;I've imported two datasets from excel ('Current_IC' and 'Current_EC') and want to combine the two datasets to create a new table called&amp;nbsp;CurrentData.&amp;nbsp;&amp;nbsp;The issue is&amp;nbsp;that I've defined a variable,&amp;nbsp;'Combined', that will&amp;nbsp;take on the values 'Both', 'IC', or 'EC'.&amp;nbsp; If the variable = 'Both' then i want to combine the two datasets.&amp;nbsp; If it's 'IC' I only want to put in 'Current_IC' to the CurrentData table, and if it's 'EC' then I only want to add 'Current_EC'.&amp;nbsp; I don't know how to add an if statement to accomplish this.&amp;nbsp; Below is the code I have to combine the&amp;nbsp;two sets but&amp;nbsp;how do I add an&amp;nbsp;if statement?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data CurrentData;&lt;/P&gt;&lt;P&gt;Set Current_IC Current_EC;&lt;/P&gt;&lt;P&gt;Run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the variable 'Combined' = IC then the code would be&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data CurrentData;&lt;/P&gt;&lt;P&gt;Set Current_IC;&lt;/P&gt;&lt;P&gt;Run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help with this would be great.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Apr 2017 20:30:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exectue-code-if-statement-true/m-p/347506#M80285</guid>
      <dc:creator>maf9</dc:creator>
      <dc:date>2017-04-05T20:30:06Z</dc:date>
    </item>
    <item>
      <title>Re: Exectue code if statement = true</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exectue-code-if-statement-true/m-p/347511#M80288</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can name multiple data sets in the data statement and output them conditionally based on the value of your Combined variable;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Something like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data combo ic_only ec_only;   
 set current_ic current_ec;   
 if combined = 'Both' then output combo;   
 else if combined = 'IC' then output ic_only;   
 else if combined = 'EC' then output ec_only;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Apr 2017 20:51:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exectue-code-if-statement-true/m-p/347511#M80288</guid>
      <dc:creator>collinelliot</dc:creator>
      <dc:date>2017-04-05T20:51:28Z</dc:date>
    </item>
  </channel>
</rss>

