<?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: How to delete rows with all missing numbers from a range of variables in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-rows-with-all-missing-numbers-from-a-range-of/m-p/844215#M82265</link>
    <description>&lt;P&gt;Thank you. It didn't work. I forgot the add that the variable names can have different names. For example the names are var1 xvar2 yname3 zvariable. These are all numeric variables.&lt;/P&gt;</description>
    <pubDate>Mon, 14 Nov 2022 21:37:10 GMT</pubDate>
    <dc:creator>ANKH1</dc:creator>
    <dc:date>2022-11-14T21:37:10Z</dc:date>
    <item>
      <title>How to delete rows with all missing numbers from a range of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-rows-with-all-missing-numbers-from-a-range-of/m-p/844208#M82262</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to delete rows that have missing values for a list of consecutive variables. For example, from a the a dataset like:&lt;/P&gt;&lt;P&gt;id&amp;nbsp; &amp;nbsp;cat var1 var2 var3 var4 stop&lt;/P&gt;&lt;P&gt;42&amp;nbsp; a 1 0 0 1 Y&lt;/P&gt;&lt;P&gt;43&amp;nbsp; b . . . .&amp;nbsp; Y&lt;/P&gt;&lt;P&gt;44&amp;nbsp; a 1 . 0 1 N&lt;/P&gt;&lt;P&gt;45 b&amp;nbsp; 0 . . 1 Y&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to delete row 43 which is missing data from var1 to var 4.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 21:04:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-rows-with-all-missing-numbers-from-a-range-of/m-p/844208#M82262</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2022-11-14T21:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete rows with all missing numbers from a range of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-rows-with-all-missing-numbers-from-a-range-of/m-p/844209#M82263</link>
      <description>&lt;P&gt;Does it have to be missing values for all variables from var1 to var4?&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 21:10:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-rows-with-all-missing-numbers-from-a-range-of/m-p/844209#M82263</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-11-14T21:10:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete rows with all missing numbers from a range of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-rows-with-all-missing-numbers-from-a-range-of/m-p/844210#M82264</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id cat $ var1 var2 var3 var4 stop $;
datalines;
42 a 1 0 0 1 Y
43 b . . . . Y
44 a 1 . 0 1 N
45 b 0 . . 1 Y
;

data want;
   set have;
   where n(var1-var4);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Nov 2022 21:12:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-rows-with-all-missing-numbers-from-a-range-of/m-p/844210#M82264</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-11-14T21:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete rows with all missing numbers from a range of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-rows-with-all-missing-numbers-from-a-range-of/m-p/844215#M82265</link>
      <description>&lt;P&gt;Thank you. It didn't work. I forgot the add that the variable names can have different names. For example the names are var1 xvar2 yname3 zvariable. These are all numeric variables.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 21:37:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-rows-with-all-missing-numbers-from-a-range-of/m-p/844215#M82265</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2022-11-14T21:37:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete rows with all missing numbers from a range of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-rows-with-all-missing-numbers-from-a-range-of/m-p/844217#M82266</link>
      <description>&lt;P&gt;Yes, missing all values from var 1 to 4.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 21:44:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-rows-with-all-missing-numbers-from-a-range-of/m-p/844217#M82266</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2022-11-14T21:44:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete rows with all missing numbers from a range of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-rows-with-all-missing-numbers-from-a-range-of/m-p/844220#M82267</link>
      <description>&lt;P&gt;What defines the range of variables?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can list them:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set have;
   where n(var1, xvar2, yname3, zvariable) ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or if you know the four variables are in order in the PDV you could use:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set have;
   where n(of var1 -- zvariable) ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want to do it based on variable position (which is odd) I would run PROC CONTENTS to figure out the names of the variables in positions 1-4, then put that into a macro variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 22:01:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-rows-with-all-missing-numbers-from-a-range-of/m-p/844220#M82267</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2022-11-14T22:01:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete rows with all missing numbers from a range of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-rows-with-all-missing-numbers-from-a-range-of/m-p/844225#M82268</link>
      <description>&lt;P&gt;Thanks! I had to list all variables like the first option you gave. And when I ran it, I realized that in the middle of the range there is a character variable. Say yname3 is a character and not numeric. How will you handle that?&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 22:20:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-rows-with-all-missing-numbers-from-a-range-of/m-p/844225#M82268</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2022-11-14T22:20:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete rows with all missing numbers from a range of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-rows-with-all-missing-numbers-from-a-range-of/m-p/844232#M82270</link>
      <description>&lt;P&gt;Do you want to include the character variable or exclude it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to exclude it, you can do:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where n(of var1 - numeric - zvariable) ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;That will only include the numeric variables in the range.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to include the character variable, you can switch from the N function to the CMISS function, which can handle both numeric and character variables:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where cmiss(of var1 -- zvariable) &amp;lt; 5  ; *assuming there are 5 variables in this range;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 22:54:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-rows-with-all-missing-numbers-from-a-range-of/m-p/844232#M82270</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2022-11-14T22:54:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete rows with all missing numbers from a range of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-rows-with-all-missing-numbers-from-a-range-of/m-p/844235#M82271</link>
      <description>&lt;P&gt;This is very helpful. I would want to include character variables as well. But "where" with cmiss() is not working for character variables.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 23:16:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-rows-with-all-missing-numbers-from-a-range-of/m-p/844235#M82271</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2022-11-14T23:16:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete rows with all missing numbers from a range of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-rows-with-all-missing-numbers-from-a-range-of/m-p/844241#M82272</link>
      <description>&lt;P&gt;What do you mean "not working"? Do you get an error, or the wrong result?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try making a little example like what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;&amp;nbsp;posted where there is a data step for making a HAVE dataset with a few records, and then a WANT step using CMISS. &amp;nbsp;If you get errors in the log, please post the log as well. &amp;nbsp;CMISS should work with both numeric and character variables. The documentation for CMISS is:&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p1tth4ltf640din1ey86ubo2lky2.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p1tth4ltf640din1ey86ubo2lky2.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2022 00:16:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-rows-with-all-missing-numbers-from-a-range-of/m-p/844241#M82272</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2022-11-15T00:16:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete rows with all missing numbers from a range of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-rows-with-all-missing-numbers-from-a-range-of/m-p/844252#M82273</link>
      <description>&lt;P&gt;This is the code:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data want;
   set have;
   where cmiss(var1 -- zvariable) &amp;lt;5;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Where zvaribale is a character variable. I get this error in the log:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: WHERE&amp;nbsp; clause operator requires numeric values.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2022 01:43:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-rows-with-all-missing-numbers-from-a-range-of/m-p/844252#M82273</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2022-11-15T01:43:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete rows with all missing numbers from a range of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-rows-with-all-missing-numbers-from-a-range-of/m-p/844356#M82276</link>
      <description>&lt;P&gt;When you use the --&amp;nbsp; or - list as an argument to a function, you need to use the word OF at the beginning. Try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set have;
   where cmiss(OF var1 -- zvariable) &amp;lt; 5 ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you don't write OF, SAS will do subtraction:&lt;/P&gt;
&lt;PRE&gt;var1 - (-zvariable) &lt;/PRE&gt;
&lt;P&gt;The error you're getting is because SAS is trying to do subtraction with a character variable.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2022 13:25:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-rows-with-all-missing-numbers-from-a-range-of/m-p/844356#M82276</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2022-11-15T13:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete rows with all missing numbers from a range of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-rows-with-all-missing-numbers-from-a-range-of/m-p/844510#M82284</link>
      <description>&lt;P&gt;Thanks for your reply. I added the word OF as advised and I am getting this error in the log:&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="Capture (1).PNG" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/77352i3DCA6579FFE799CF/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture (1).PNG" alt="Capture (1).PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2022 22:06:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-rows-with-all-missing-numbers-from-a-range-of/m-p/844510#M82284</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2022-11-15T22:06:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete rows with all missing numbers from a range of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-rows-with-all-missing-numbers-from-a-range-of/m-p/844514#M82286</link>
      <description>&lt;P&gt;My apologies. It looks like you can't use a -- in a WHERE statement.&amp;nbsp; Which I guess makes sense, because it relies on the order of variables in the PDV.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It should work if you change to a subsetting IF, e.g.:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;12   data want;
13     set have ;
14     if cmiss(OF var1 -- zvariable) &amp;lt; 5 ;  *IF not where;
15   run;

NOTE: There were 1 observations read from the data set WORK.HAVE.
NOTE: The data set WORK.WANT has 1 observations and 3 variables.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Nov 2022 22:14:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-rows-with-all-missing-numbers-from-a-range-of/m-p/844514#M82286</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2022-11-15T22:14:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete rows with all missing numbers from a range of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-rows-with-all-missing-numbers-from-a-range-of/m-p/844537#M82287</link>
      <description>&lt;P&gt;It worked! Thank you so much! This is extremely helpful.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2022 23:53:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-rows-with-all-missing-numbers-from-a-range-of/m-p/844537#M82287</guid>
      <dc:creator>ANKH1</dc:creator>
      <dc:date>2022-11-15T23:53:55Z</dc:date>
    </item>
  </channel>
</rss>

