<?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 creating a new column based on observations in other columns in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Help-creating-a-new-column-based-on-observations-in-other/m-p/240823#M44504</link>
    <description>&lt;P&gt;Another way&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data need (Drop= i);
set have;
array varx(5) A--E; 
	if SUM(A,B,C,D) &amp;gt; 1 then DO; 
		R = 1;
			Do i =1 to dim(varx);
			varx(i)=.;
			End;
	End;
	Else R=.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 24 Dec 2015 18:24:21 GMT</pubDate>
    <dc:creator>mohamed_zaki</dc:creator>
    <dc:date>2015-12-24T18:24:21Z</dc:date>
    <item>
      <title>Help creating a new column based on observations in other columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-creating-a-new-column-based-on-observations-in-other/m-p/240818#M44499</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am having trouble creating a new variable using conditions, I've tried data steps but to no avail.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My data set looks like this right now:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;A B C D E
1 . 1 1 .
. 1 . . . 
1 . 1 . 1 &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to look like this&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;A B C D E R
. . &amp;nbsp;. &amp;nbsp;. 1
. 1&amp;nbsp;. . . .
. . .&amp;nbsp;. . 1&lt;/PRE&gt;&lt;P&gt;So the idea that i've used is if the sum of a -- d is greater than 1 then set R equal to 1 else . &amp;nbsp;and then drop the observations if 1 is present in a &amp;amp; b &amp;amp; c &amp;amp; d &amp;amp; e but its not doing it for me perhaps its due to missing values.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;code i've used so far:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data campZ;
	set campY;
	select;
	when (sum(Macroscopic -- Symbolic &amp;gt; 1)) Random = 1;
    otherwise;
end; 
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I've tried Proc SQL as well but I have been mainly focusing on the data step but any help will be great.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;Will&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Dec 2015 16:48:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-creating-a-new-column-based-on-observations-in-other/m-p/240818#M44499</guid>
      <dc:creator>wmedina</dc:creator>
      <dc:date>2015-12-24T16:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: Help creating a new column based on observations in other columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-creating-a-new-column-based-on-observations-in-other/m-p/240820#M44501</link>
      <description>&lt;P&gt;Solved:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://stackoverflow.com/questions/34455896/creating-a-new-column-based-on-observations-in-other-columns/34455935#34455935" target="_blank"&gt;http://stackoverflow.com/questions/34455896/creating-a-new-column-based-on-observations-in-other-columns/34455935#34455935&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Dec 2015 17:29:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-creating-a-new-column-based-on-observations-in-other/m-p/240820#M44501</guid>
      <dc:creator>wmedina</dc:creator>
      <dc:date>2015-12-24T17:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: Help creating a new column based on observations in other columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-creating-a-new-column-based-on-observations-in-other/m-p/240822#M44503</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data need (Drop= i numMissing);
set have;
array varx(*) A--E; 
numMissing = cmiss(A,B,C,D);
	if numMissing &amp;lt; 3 then DO; 
		R = 1;
			Do i =1 to dim(varx);
				varx(i)=.;
			End;
	End;
	Else R=.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 24 Dec 2015 18:29:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-creating-a-new-column-based-on-observations-in-other/m-p/240822#M44503</guid>
      <dc:creator>mohamed_zaki</dc:creator>
      <dc:date>2015-12-24T18:29:58Z</dc:date>
    </item>
    <item>
      <title>Re: Help creating a new column based on observations in other columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-creating-a-new-column-based-on-observations-in-other/m-p/240823#M44504</link>
      <description>&lt;P&gt;Another way&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data need (Drop= i);
set have;
array varx(5) A--E; 
	if SUM(A,B,C,D) &amp;gt; 1 then DO; 
		R = 1;
			Do i =1 to dim(varx);
			varx(i)=.;
			End;
	End;
	Else R=.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 24 Dec 2015 18:24:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-creating-a-new-column-based-on-observations-in-other/m-p/240823#M44504</guid>
      <dc:creator>mohamed_zaki</dc:creator>
      <dc:date>2015-12-24T18:24:21Z</dc:date>
    </item>
    <item>
      <title>Re: Help creating a new column based on observations in other columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-creating-a-new-column-based-on-observations-in-other/m-p/240845#M44516</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input A B C D E;
cards;
1 . 1 1 .
. 1 . . . 
1 . 1 . 1
;
run;
data want;
 set have;
 if sum(of A--E) &amp;gt; 1 then do;
  Random = 1;
  call missing(of A--E);
 end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 25 Dec 2015 01:47:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-creating-a-new-column-based-on-observations-in-other/m-p/240845#M44516</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-12-25T01:47:42Z</dc:date>
    </item>
  </channel>
</rss>

