<?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: If one of a set of variables is a certain value and others are missing - in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/If-one-of-a-set-of-variables-is-a-certain-value-and-others-are/m-p/437715#M109041</link>
    <description>&lt;P&gt;one way to do this and is similar to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;code and I just added one more condition&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
array name(*) $ DEMA4A--DEMA4F;
if whichc('Y', of name[*]) and whichc('U', of name[*]) = 0 then 
do i = 1 to dim(name);
if name[i] =' ' then name[i] = 'N';
else name[i] =name[i];
end;
drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Feb 2018 18:33:46 GMT</pubDate>
    <dc:creator>kiranv_</dc:creator>
    <dc:date>2018-02-15T18:33:46Z</dc:date>
    <item>
      <title>If one of a set of variables is a certain value and others are missing -</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-one-of-a-set-of-variables-is-a-certain-value-and-others-are/m-p/437703#M109032</link>
      <description>&lt;P&gt;In a data step, if one of a set of variables is a certain value and others are missing, how do we tell SAS to fill in other variables with a certain value?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dataset.JPG" style="width: 569px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18627iECC9832DE4437F62/image-size/large?v=v2&amp;amp;px=999" role="button" title="dataset.JPG" alt="dataset.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Above is the data set I have. If one of DEMA4A to DEMA4F is Y but others are missing, I want to fill in these missings with "N"&lt;/P&gt;&lt;P&gt;If one or more values of DEMA4A to DEMA4F are U, I don't want to fill in any missing values.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I write this code?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 17:33:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-one-of-a-set-of-variables-is-a-certain-value-and-others-are/m-p/437703#M109032</guid>
      <dc:creator>gsk</dc:creator>
      <dc:date>2018-02-15T17:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: If one of a set of variables is a certain value and others are missing -</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-one-of-a-set-of-variables-is-a-certain-value-and-others-are/m-p/437706#M109035</link>
      <description>&lt;P&gt;Use WHICHC to evaluate your condition:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if whichc(‘Y’, of DEMA4A—DEMA4f) then do;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;your assignment statements;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 17:36:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-one-of-a-set-of-variables-is-a-certain-value-and-others-are/m-p/437706#M109035</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-02-15T17:36:33Z</dc:date>
    </item>
    <item>
      <title>Re: If one of a set of variables is a certain value and others are missing -</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-one-of-a-set-of-variables-is-a-certain-value-and-others-are/m-p/437707#M109036</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
array t(*)DEMA4A--DEMA4F;
x1=whichc('Y', of t[*]);
if x1&amp;gt;0 then do;
do _n_=1 to dim(t);
if _n_ ne x1 then t(_n_)='N';
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Feb 2018 17:41:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-one-of-a-set-of-variables-is-a-certain-value-and-others-are/m-p/437707#M109036</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-02-15T17:41:50Z</dc:date>
    </item>
    <item>
      <title>Re: If one of a set of variables is a certain value and others are missing -</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-one-of-a-set-of-variables-is-a-certain-value-and-others-are/m-p/437715#M109041</link>
      <description>&lt;P&gt;one way to do this and is similar to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;code and I just added one more condition&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
array name(*) $ DEMA4A--DEMA4F;
if whichc('Y', of name[*]) and whichc('U', of name[*]) = 0 then 
do i = 1 to dim(name);
if name[i] =' ' then name[i] = 'N';
else name[i] =name[i];
end;
drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 18:33:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-one-of-a-set-of-variables-is-a-certain-value-and-others-are/m-p/437715#M109041</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2018-02-15T18:33:46Z</dc:date>
    </item>
  </channel>
</rss>

