<?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: Counting variables that are missing by group in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Counting-variables-that-are-missing-by-group/m-p/894298#M353281</link>
    <description>&lt;P&gt;If you use a list like "of thisvar -- thatvar" , note there are 2 dashes, then SAS uses the variable positions to build the list and gets all of the variables starting at thisvar and ending at thatvar.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/452847"&gt;@AJYass&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;OH! Okay thanks for point that out.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;They are all uniquely named variables unfortunately.&lt;/P&gt;
&lt;P&gt;The first is A1_1 and the final is Vstatus so the code should be&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;Countofmissing= cmiss(OF A1_1-Vstatus);&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is that correct? Thanks so much for all the help!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 14 Sep 2023 16:23:25 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2023-09-14T16:23:25Z</dc:date>
    <item>
      <title>Counting variables that are missing by group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Counting-variables-that-are-missing-by-group/m-p/894281#M353268</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not sure how to do what I want. Basically I have a group variable of organizations I am interested in, I would like to look across the data set see how many variables are empty for each organization.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So like data I have:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ORG&lt;/TD&gt;&lt;TD&gt;Var1&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Var2&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Var3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;OrgA&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;OrgB&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;OrgC&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Want:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ORG&lt;/TD&gt;&lt;TD&gt;Count of Missing Var&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;OrgA&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;OrgB&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;OrgC&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have about 40 organizations in the group variable and about 200 variables total.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 15:03:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Counting-variables-that-are-missing-by-group/m-p/894281#M353268</guid>
      <dc:creator>AJYass</dc:creator>
      <dc:date>2023-09-14T15:03:12Z</dc:date>
    </item>
    <item>
      <title>Re: Counting variables that are missing by group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Counting-variables-that-are-missing-by-group/m-p/894284#M353270</link>
      <description>&lt;PRE&gt;data want;
   set have 
   Countofmissing= cmiss(Var1, var2, var3);
run;&lt;/PRE&gt;
&lt;P&gt;should do it.&lt;/P&gt;
&lt;P&gt;If you have lots more variables there may be ways to shorten the syntax with variable lists but we would have to see a more complete description of your data.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 15:09:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Counting-variables-that-are-missing-by-group/m-p/894284#M353270</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-09-14T15:09:34Z</dc:date>
    </item>
    <item>
      <title>Re: Counting variables that are missing by group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Counting-variables-that-are-missing-by-group/m-p/894285#M353271</link>
      <description>&lt;P&gt;I do have a lot more variables, I need to look at them all. What info do you think we need?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried&lt;/P&gt;&lt;P&gt;proc sort data = Have; by Org; run;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;set Have;&lt;BR /&gt;Countofmissing= cmiss(Var1-Var200);&lt;BR /&gt;by Org;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it did not work, the new Countofmissing wasnt counting. They were all equal to 1.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 15:22:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Counting-variables-that-are-missing-by-group/m-p/894285#M353271</guid>
      <dc:creator>AJYass</dc:creator>
      <dc:date>2023-09-14T15:22:11Z</dc:date>
    </item>
    <item>
      <title>Re: Counting variables that are missing by group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Counting-variables-that-are-missing-by-group/m-p/894289#M353274</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/452847"&gt;@AJYass&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I do have a lot more variables, I need to look at them all. What info do you think we need?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried&lt;/P&gt;
&lt;P&gt;proc sort data = Have; by Org; run;&lt;/P&gt;
&lt;P&gt;data want;&lt;BR /&gt;set Have;&lt;BR /&gt;Countofmissing= cmiss(Var1-Var200);&lt;BR /&gt;by Org;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But it did not work, the new Countofmissing wasnt counting. They were all equal to 1.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You subtracted variable Var200 from Var1.&lt;/P&gt;
&lt;P&gt;Use&amp;nbsp; :&amp;nbsp; cmiss( OF var1-var200);&lt;/P&gt;
&lt;P&gt;or if all of your variables are actually named like that&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; cmiss (of var:)&lt;/P&gt;
&lt;P&gt;the : is a list builder that says "use all the variables whose names start with VAR (or whatever characters you supply).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 15:31:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Counting-variables-that-are-missing-by-group/m-p/894289#M353274</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-09-14T15:31:33Z</dc:date>
    </item>
    <item>
      <title>Re: Counting variables that are missing by group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Counting-variables-that-are-missing-by-group/m-p/894294#M353278</link>
      <description>&lt;P&gt;OH! Okay thanks for point that out.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;They are all uniquely named variables unfortunately.&lt;/P&gt;&lt;P&gt;The first is A1_1 and the final is Vstatus so the code should be&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;Countofmissing= cmiss(OF A1_1-Vstatus);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is that correct? Thanks so much for all the help!&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 15:58:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Counting-variables-that-are-missing-by-group/m-p/894294#M353278</guid>
      <dc:creator>AJYass</dc:creator>
      <dc:date>2023-09-14T15:58:27Z</dc:date>
    </item>
    <item>
      <title>Re: Counting variables that are missing by group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Counting-variables-that-are-missing-by-group/m-p/894298#M353281</link>
      <description>&lt;P&gt;If you use a list like "of thisvar -- thatvar" , note there are 2 dashes, then SAS uses the variable positions to build the list and gets all of the variables starting at thisvar and ending at thatvar.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/452847"&gt;@AJYass&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;OH! Okay thanks for point that out.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;They are all uniquely named variables unfortunately.&lt;/P&gt;
&lt;P&gt;The first is A1_1 and the final is Vstatus so the code should be&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;Countofmissing= cmiss(OF A1_1-Vstatus);&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is that correct? Thanks so much for all the help!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 16:23:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Counting-variables-that-are-missing-by-group/m-p/894298#M353281</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-09-14T16:23:25Z</dc:date>
    </item>
  </channel>
</rss>

