<?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: Indicate if row had missing values in selection of columns in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Indicate-if-row-had-missing-values-in-selection-of-columns/m-p/783399#M249779</link>
    <description>&lt;P&gt;The statement&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  miss=(cats(of v1-v3)^=' ');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;assigns a 1 to MISS if the expression &lt;EM&gt;&lt;STRONG&gt;cats(of v1-v3)^=' '&lt;/STRONG&gt;&lt;/EM&gt; is true, or a 0 otherwise.&amp;nbsp; The CATS function concatenates the characters of V1, V2, and V3 (while stripping all leading or trailing blanks from the components).&amp;nbsp; &amp;nbsp;If all of them are missing (i.e. blank) then the CATS result is blank, making the expression true.&amp;nbsp; So&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
 infile cards delimiter='|';
input X1 $ V1 $ V2 $ V3 $;
cards;
	|a1|	|a1	|
	||c2,a1|	c3,c2	|
	||b2|		|
te	||	|	|
;
run;
data want;
  set have;
  miss=cats(of v1-v3)^=' ';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;will do what you want.&lt;/P&gt;</description>
    <pubDate>Wed, 01 Dec 2021 15:11:26 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2021-12-01T15:11:26Z</dc:date>
    <item>
      <title>Indicate if row had missing values in selection of columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Indicate-if-row-had-missing-values-in-selection-of-columns/m-p/783394#M249776</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset that roughly looks like the one below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data have;
 infile cards delimiter='|';
input X1 $ V1 $ V2 $ V3 $;
cards;
	|a1|	|a1	|
	||c2,a1|	c3,c2	|
	||b2|		|
te	||	|	|
;
run;&lt;/PRE&gt;&lt;P&gt;Now I want to create a new column&amp;nbsp;&lt;STRONG&gt;miss&amp;nbsp;&lt;/STRONG&gt;that indicates whether or not a row had any observation in V1, V2, or V3.&lt;/P&gt;&lt;P&gt;Row 1, 2 and 3 all have values in either V1, V2, V3 or some combination, so&amp;nbsp;&lt;STRONG&gt;miss&lt;/STRONG&gt; would here be 1.&lt;/P&gt;&lt;P&gt;Row 4 has no values in V1-V3, so&amp;nbsp;&lt;STRONG&gt;miss&lt;/STRONG&gt; would be 0.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Important is that the solution is dynamic, since the dataset grows on a frequent basis.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think an additional issue for my data is that i'm not sure these empty spaces are actually flagged as missing? How would I go about checking that? i've tried some of the missing functions in SAS, but i find them so unintuitive that I might as well just be doing it wrong and getting confusing results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a bunch.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Dec 2021 14:59:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Indicate-if-row-had-missing-values-in-selection-of-columns/m-p/783394#M249776</guid>
      <dc:creator>cmues</dc:creator>
      <dc:date>2021-12-01T14:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: Indicate if row had missing values in selection of columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Indicate-if-row-had-missing-values-in-selection-of-columns/m-p/783395#M249777</link>
      <description>&lt;P&gt;Use the &lt;A href="https://documentation.sas.com/doc/en/pgmmvacdc/9.4/lefunctionsref/p1tth4ltf640din1ey86ubo2lky2.htm" target="_self"&gt;CMISS&lt;/A&gt; function to count the number of missings.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Dec 2021 15:02:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Indicate-if-row-had-missing-values-in-selection-of-columns/m-p/783395#M249777</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-12-01T15:02:59Z</dc:date>
    </item>
    <item>
      <title>Re: Indicate if row had missing values in selection of columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Indicate-if-row-had-missing-values-in-selection-of-columns/m-p/783399#M249779</link>
      <description>&lt;P&gt;The statement&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  miss=(cats(of v1-v3)^=' ');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;assigns a 1 to MISS if the expression &lt;EM&gt;&lt;STRONG&gt;cats(of v1-v3)^=' '&lt;/STRONG&gt;&lt;/EM&gt; is true, or a 0 otherwise.&amp;nbsp; The CATS function concatenates the characters of V1, V2, and V3 (while stripping all leading or trailing blanks from the components).&amp;nbsp; &amp;nbsp;If all of them are missing (i.e. blank) then the CATS result is blank, making the expression true.&amp;nbsp; So&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
 infile cards delimiter='|';
input X1 $ V1 $ V2 $ V3 $;
cards;
	|a1|	|a1	|
	||c2,a1|	c3,c2	|
	||b2|		|
te	||	|	|
;
run;
data want;
  set have;
  miss=cats(of v1-v3)^=' ';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;will do what you want.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Dec 2021 15:11:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Indicate-if-row-had-missing-values-in-selection-of-columns/m-p/783399#M249779</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2021-12-01T15:11:26Z</dc:date>
    </item>
    <item>
      <title>Re: Indicate if row had missing values in selection of columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Indicate-if-row-had-missing-values-in-selection-of-columns/m-p/783400#M249780</link>
      <description>&lt;P&gt;Sorry, I really do not understand at all how to apply these functions to create a column or even a summary. Nor do I feel the documentation is very clear on it. Is it part of a DATA or PROC?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Dec 2021 15:11:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Indicate-if-row-had-missing-values-in-selection-of-columns/m-p/783400#M249780</guid>
      <dc:creator>cmues</dc:creator>
      <dc:date>2021-12-01T15:11:53Z</dc:date>
    </item>
    <item>
      <title>Re: Indicate if row had missing values in selection of columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Indicate-if-row-had-missing-values-in-selection-of-columns/m-p/783401#M249781</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/406843"&gt;@cmues&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Sorry, I really do not understand at all how to apply these functions to create a column or even a summary. Nor do I feel the documentation is very clear on it. Is it part of a DATA or PROC?&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;In a data step&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;count=cmiss(of var1-var3);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Dec 2021 15:18:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Indicate-if-row-had-missing-values-in-selection-of-columns/m-p/783401#M249781</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-12-01T15:18:15Z</dc:date>
    </item>
  </channel>
</rss>

