<?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 variable with large missing values in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-variable-with-large-missing-values/m-p/34950#M8557</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you criteria is 69711, then you should not use 'eq', which only took out those variablers with exact 69711 missing obs. Instead, you should use 'ge' or '&amp;gt;=',&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if _x{i} &amp;gt;= 69711 then _list=catx(' ',_list,vname(_x{i}));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, take out the following statements, since you are not using the total number of obs as criteria, that will save you some time:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select count(*) into : nobs from GEOG.USA;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 17 Mar 2012 13:55:05 GMT</pubDate>
    <dc:creator>Haikuo</dc:creator>
    <dc:date>2012-03-17T13:55:05Z</dc:date>
    <item>
      <title>How to delete variable with large missing values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-variable-with-large-missing-values/m-p/34944#M8551</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I understand how to delete variable using "drop" function. However, I have a large data set with many variables, it is time consuming for me to drop them one-by-one. Imagine that by merely copy and paste the variable names also take an hour. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I used proc means with an option of NMISS to view all the variables with their number of missing values. Some variables have very large number of missing values (even 100% missing). I would wish to delete these variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wish to gather opinions here on how to write a program that can drop variables with conditions that if NMISS of variables is more than a certain number, for example, 69710. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;mspak&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 17 Mar 2012 08:59:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-variable-with-large-missing-values/m-p/34944#M8551</guid>
      <dc:creator>mspak</dc:creator>
      <dc:date>2012-03-17T08:59:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete variable with large missing values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-variable-with-large-missing-values/m-p/34945#M8552</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I did it by copy and paste the NMISS report into excel, then I filter them according my criteria.&amp;nbsp; Lastly, I copy the list with the variables that to be deleted by using drop function. It works. But if there is an easy way via SAS program, will be great!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;mspak&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 17 Mar 2012 10:04:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-variable-with-large-missing-values/m-p/34945#M8552</guid>
      <dc:creator>mspak</dc:creator>
      <dc:date>2012-03-17T10:04:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete variable with large missing values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-variable-with-large-missing-values/m-p/34946#M8553</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi mspak,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is Ksharp's code to drop variables with all missing values. You can modify it to drop variables with certain number of missing values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note:&amp;nbsp; the libname and dataset name have to be&amp;nbsp; CAPITAL LETTERS in " where libname='WORK' and memname='HAVE';"&lt;/P&gt;&lt;P&gt;replace "&amp;amp;nobs" with&amp;nbsp; "your- number" in "&amp;nbsp; if _x{i} eq &amp;amp;nobs then _list=catx(' ',_list,vname(_x{i}));".&lt;/P&gt;&lt;P&gt;you need to increase the length of " _list" in "length _list $ 4000;".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;infile cards missover;&lt;/P&gt;&lt;P&gt;input&amp;nbsp;&amp;nbsp; Name&amp;nbsp; $&amp;nbsp;&amp;nbsp; DOB&amp;nbsp; :$10.&amp;nbsp;&amp;nbsp;&amp;nbsp; (Add1&amp;nbsp; Add2 Addr3) (:$);&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; John&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10/10/80&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Alan&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11/11/81&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Paul&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10/10/79&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt; select catx(' ','nmiss(',name,') as',name) into : list separated by ','&lt;/P&gt;&lt;P&gt;&amp;nbsp; from dictionary.columns &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; where libname='WORK' and memname='HAVE';&lt;/P&gt;&lt;P&gt; select count(*) into : nobs from have;&lt;/P&gt;&lt;P&gt; create table temp as&lt;/P&gt;&lt;P&gt;&amp;nbsp; select &amp;amp;list from have;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt; set temp;&lt;/P&gt;&lt;P&gt; length _list $ 4000;&lt;/P&gt;&lt;P&gt; array _x{*} _numeric_;&lt;/P&gt;&lt;P&gt; do i=1 to dim(_x);&lt;/P&gt;&lt;P&gt;&amp;nbsp; if _x{i} eq &amp;amp;nobs then _list=catx(' ',_list,vname(_x{i}));&lt;/P&gt;&lt;P&gt; end;&lt;/P&gt;&lt;P&gt; call symputx('drop',_list);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt; set have(drop=&amp;amp;drop);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Linlin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 17 Mar 2012 12:39:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-variable-with-large-missing-values/m-p/34946#M8553</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-03-17T12:39:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete variable with large missing values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-variable-with-large-missing-values/m-p/34947#M8554</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Linlin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe this is the way, but it seems more complicated than I obtained the list from excel. If there is a macro function to work out this steps, would be great!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;mspak&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 17 Mar 2012 12:58:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-variable-with-large-missing-values/m-p/34947#M8554</guid>
      <dc:creator>mspak</dc:creator>
      <dc:date>2012-03-17T12:58:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete variable with large missing values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-variable-with-large-missing-values/m-p/34948#M8555</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi mspak,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have you tried the code? I don't understand why you think it is complicated to use the code. what you need to do is just replacing the libname and dataset with your own, then all the unwanted variables are dropped.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;there are other ways from the link &lt;A _jive_internal="true" href="https://communities.sas.com/message/119802#119802"&gt;http://communities.sas.com/message/119802#119802&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 17 Mar 2012 13:17:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-variable-with-large-missing-values/m-p/34948#M8555</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-03-17T13:17:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete variable with large missing values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-variable-with-large-missing-values/m-p/34949#M8556</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi again,&lt;/P&gt;&lt;P&gt;I couldn't get the answer. I replaced the "WORK" with my libname "GEOG" and the file name "HAVE" with "USA". The criteria if NMISS=69711, then variables to be deleted was set. There must some errors but tehre is no error message in log. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt; select catx(' ','nmiss(',name,') as',name) into : list separated by ','&lt;/P&gt;&lt;P&gt;&amp;nbsp; from dictionary.columns &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; where libname='GEOG' and memname='USA';&lt;/P&gt;&lt;P&gt; select count(*) into : nobs from GEOG.USA;&lt;/P&gt;&lt;P&gt; create table temp as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; select &amp;amp;list from GEOG.USA;&lt;/P&gt;&lt;P&gt; quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt; set geog.usa;&lt;/P&gt;&lt;P&gt; length _list $ 4000;&lt;/P&gt;&lt;P&gt; array _x{*} _numeric_;&lt;/P&gt;&lt;P&gt; do i=1 to dim(_x);&lt;/P&gt;&lt;P&gt;&amp;nbsp; if _x{i} eq 69711 then _list=catx(' ',_list,vname(_x{i}));&lt;/P&gt;&lt;P&gt; end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call symputx('drop',_list);&lt;/P&gt;&lt;P&gt; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt; set GEOG.USA(drop=&amp;amp;drop);&lt;/P&gt;&lt;P&gt; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC MEANS DATA=WANT NMISS N; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I checked the answer again using proc means, I found there are not deleted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;mspak&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 17 Mar 2012 13:44:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-variable-with-large-missing-values/m-p/34949#M8556</guid>
      <dc:creator>mspak</dc:creator>
      <dc:date>2012-03-17T13:44:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete variable with large missing values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-variable-with-large-missing-values/m-p/34950#M8557</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you criteria is 69711, then you should not use 'eq', which only took out those variablers with exact 69711 missing obs. Instead, you should use 'ge' or '&amp;gt;=',&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if _x{i} &amp;gt;= 69711 then _list=catx(' ',_list,vname(_x{i}));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, take out the following statements, since you are not using the total number of obs as criteria, that will save you some time:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select count(*) into : nobs from GEOG.USA;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 17 Mar 2012 13:55:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-variable-with-large-missing-values/m-p/34950#M8557</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-03-17T13:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete variable with large missing values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-variable-with-large-missing-values/m-p/34951#M8558</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Haikuo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The same answer generated even I replaced "eq" with "&amp;gt;=" As I have many variables with exact NMISS=69711, I don't think something wrong with "eq". &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;mspak. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 17 Mar 2012 14:02:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-variable-with-large-missing-values/m-p/34951#M8558</guid>
      <dc:creator>mspak</dc:creator>
      <dc:date>2012-03-17T14:02:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete variable with large missing values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-variable-with-large-missing-values/m-p/34952#M8559</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My bad, I have checked your code again, there was an error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt; set geog.usa;&lt;/P&gt;&lt;P&gt; length _list $ 4000;&lt;/P&gt;&lt;P&gt; array _x{*} _numeric_;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it should be:&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt; set temp;&lt;/P&gt;&lt;P&gt; length _list $ 4000;&lt;/P&gt;&lt;P&gt; array _x{*} _numeric_;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That is the whole purpose of temp.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 17 Mar 2012 14:07:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-variable-with-large-missing-values/m-p/34952#M8559</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-03-17T14:07:20Z</dc:date>
    </item>
    <item>
      <title>How to delete variable with large missing values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-variable-with-large-missing-values/m-p/34953#M8560</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks HaiKuo &amp;amp; Lilin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So sorry that I replaced the file name wrongly. I got the answer now &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;mspak&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 17 Mar 2012 14:15:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-delete-variable-with-large-missing-values/m-p/34953#M8560</guid>
      <dc:creator>mspak</dc:creator>
      <dc:date>2012-03-17T14:15:05Z</dc:date>
    </item>
  </channel>
</rss>

