LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (April 2010, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 13 Apr 2010 03:31:01 -0400
Reply-To:   Jim Groeneveld <jim.1stat@YAHOO.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Jim Groeneveld <jim.1stat@YAHOO.COM>
Subject:   Re: Finding variables with all missing data

Hi Bill,

Have a look at my macro DropMV that removes all variables with missing values. It has been discussed before, see: http://listserv.uga.edu/cgi-bin/wa?S2=sas-l&D=1&H=0&O=D&T=1&q=dropmv&s=&f=jim&a=&b=

Regards - Jim. -- Jim Groeneveld, Netherlands Statistician, SAS consultant http://jim.groeneveld.eu.tf

On Mon, 12 Apr 2010 18:54:34 -0400, William Krause <wkrause2003@YAHOO.COM> wrote:

>I have a dataset that contains 5000 rows but contains around 20,000 >variables. The variable name are too large to fit into a macro variable >(exceeds the max length). > >How can I find all the variables which contain only missing values (blanks >for character variables) and (. for numeric variables). > >I have some code from somewhere that uses a macro variable but it only >works within the macro length limits. > >This is the code I used -- doesn't work for large variable lists. > >All I'm concerned with is identifying the variables that contain values >that are all blank. > >**** Finding and Dropping Emtpy Variables that contain all blank/missing >values. ******* ; >options symbolgen; > >data class; > set sashelp.class; >name=' '; >ndummy=.; >cdummy=' '; > >proc sql noprint; > select 'case when nmiss('||compress(name)||')=count(*) then "' > ||compress(name)||'" else " " end' into :nlst separated by "||' '||" > from dictionary.columns >where libname='WORK' and memname='CLASS' >; >select distinct &nlst >into :droplst >from class >; > >data class; > set class; > drop &droplst; >run; > >proc print; >run; > >I had modified the program above to write out the cases statements to a >external file. I modified it but I couldn't get it to work either. >I put a statements in the external dataset: >proc sql ; >create table blnkmrv as > >Also removed the comma from the end of the last case statement. > >libname blnk " C:\MYDATA" ; >proc sql noprint; > CREATE TABLE BLNK_CASES AS > select 'case when nmiss('||compress(name)||')=count(*) then "' > ||compress(name)||'" else " " end' || ',' > from dictionary.columns > where libname='BLNK' and memname='MYCASES' >; >quit ; > >FILENAME TMP "C:\TEMP\BLNKDATA.SAS" ; >DATA _NULL_ ; > SET BLNK_CASES ; > FILE TMP ; > PUT _TEMA001 ; >RUN ; > > >PROC SQL ; > %INCLUDE TMP >; >QUIT ; > > >You can ignore the code above. > >All I need I a solution that will process the 20000 variables. > >Thanks for you assistance. > >Bill K. >wkrause2003@yahoo.com


Back to: Top of message | Previous page | Main SAS-L page