<?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 Creating a column with IF procedure in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-column-with-IF-procedure/m-p/447227#M112289</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm new to SAS and I'm not sure what I'm doing wrong with my code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a big data set and I'm trying to create a new column from existing variables given that ANY of them is 1.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data AVG1;&amp;nbsp;&lt;/P&gt;&lt;P&gt;set WORK.AVG1;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;IF LPLAQUE=1 OR RPLAQUE=1 OR PLAQUE=1 OR PLAQUE1=1&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;THEN TPLAQUE=1;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ELSE IF LPLAQUE=0 OR RPLAQUE=0 OR PLAQUE=0 OR PLAQUE1=0&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;THEN TPLAQUE=0;&amp;nbsp;&lt;/P&gt;&lt;P&gt;RUN;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SAS doesn't come up with an error during the log, but on the output the table has no data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As I said, I am very new to SAS so I may be missing something very obvious.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 20 Mar 2018 18:47:52 GMT</pubDate>
    <dc:creator>MerAgSo</dc:creator>
    <dc:date>2018-03-20T18:47:52Z</dc:date>
    <item>
      <title>Creating a column with IF procedure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-column-with-IF-procedure/m-p/447227#M112289</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm new to SAS and I'm not sure what I'm doing wrong with my code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a big data set and I'm trying to create a new column from existing variables given that ANY of them is 1.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data AVG1;&amp;nbsp;&lt;/P&gt;&lt;P&gt;set WORK.AVG1;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;IF LPLAQUE=1 OR RPLAQUE=1 OR PLAQUE=1 OR PLAQUE1=1&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;THEN TPLAQUE=1;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ELSE IF LPLAQUE=0 OR RPLAQUE=0 OR PLAQUE=0 OR PLAQUE1=0&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;THEN TPLAQUE=0;&amp;nbsp;&lt;/P&gt;&lt;P&gt;RUN;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SAS doesn't come up with an error during the log, but on the output the table has no data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As I said, I am very new to SAS so I may be missing something very obvious.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Mar 2018 18:47:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-column-with-IF-procedure/m-p/447227#M112289</guid>
      <dc:creator>MerAgSo</dc:creator>
      <dc:date>2018-03-20T18:47:52Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a column with IF procedure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-column-with-IF-procedure/m-p/447230#M112290</link>
      <description>&lt;P&gt;Well, you likely destroyed your original data so you'll first need to recreate avg1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After you do that, please run the code (below) and post your log and explain what isn't working.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data AVG2; 
set WORK.AVG1; 
       IF LPLAQUE=1 OR RPLAQUE=1 OR PLAQUE=1 OR PLAQUE1=1 
       THEN TPLAQUE=1; 
      ELSE IF LPLAQUE=0 OR RPLAQUE=0 OR PLAQUE=0 OR PLAQUE1=0
     THEN TPLAQUE=0; 
RUN; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Mar 2018 18:53:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-column-with-IF-procedure/m-p/447230#M112290</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-03-20T18:53:26Z</dc:date>
    </item>
  </channel>
</rss>

