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 2004, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 16 Apr 2004 11:16:57 -0400
Reply-To:   SAS Bigot <sas_bigot@ML1.NET>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   SAS Bigot <sas_bigot@ML1.NET>
Subject:   Re: cleaning up a dataset
In-Reply-To:   <20040415150452.80717.qmail@web25209.mail.ukl.yahoo.com>
Content-Type:   text/plain; charset="iso-8859-1"

You are correct that 'x=" "' will work for numeric variables, but SAS provides a function, MISSING, that tests a variable or expression (numeric or char) and returns a 1 if the value of the var is missing and 0 if not. Using the function will prevent the internal conversions and note generations.

----- Original message ----- From: "Ari Toikka" <toikkari@YAHOO.CO.UK> To: SAS-L@LISTSERV.UGA.EDU Date: Thu, 15 Apr 2004 16:04:52 +0100 Subject: Re: cleaning up a dataset

Hi,

/* take the variable names */ proc contents data = test out= cont(keep=name); run;

/* generate macro variable keeppgm, which holds program */ /* statements which generate a keep list */ /* if x=" " is valid for numeric variables too */ data _null_; length keeppgm $ 2000; set cont nobs=records; keeppgm = substr(keeppgm,1,length(keeppgm)) !! 'if ' !! compress(name) !! '=" " then keeplist = substr(keeplist,1,length(keeplist)) !! " " !! "' !! compress(name) !! '";'; retain keeppgm; if _n_ = records then call symput('keeppgm', keeppgm); run;

/* generate the keep list and use it */ data test2; length keeplist $ 2000; set test; &keeppgm; call symput('keeplist',keeplist); keep &keeplist; run;

Ari Toikka Statistics Finland

William Kossack <kossackw@NJC.ORG> wrote: I have a dataset with only one record both character and numberic fields.

I'm trying to find a way of keeping only the variables that missing data so a report can be generated showing where information is missing

--------------------------------- Yahoo! Messenger - Communicate instantly..."Ping" your friends today! Download Messenger Now

-- http://www.fastmail.fm - The way an email service should be


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