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:         Thu, 15 Apr 2004 16:25:13 +0100
Reply-To:     Ari Toikka <toikkari@YAHOO.CO.UK>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Ari Toikka <toikkari@YAHOO.CO.UK>
Subject:      Re: cleaning up a dataset
In-Reply-To:  <C93AE4021921784ABAE89216FF4C371803D2CE54@ROC2T7.ghc.org>
Content-Type: text/plain; charset=iso-8859-1

Hi,

actually the solution proposed by Roy Pardee is the simplest:

options missing=' '; proc transpose data=test out=test2; var _all_; run;

data test2(keep=_name_); set test2; if col1=' '; run;

proc transpose data=test2 out=test3(drop=_name_ _label_); var _all_; run;

Ari Toikka Statistics Finland

"Pardee, Roy" <pardee.r@GHC.ORG> wrote:How about:

- PROC TRANSPOSE your data so you've got one obs per var. - Filter out the missing values in the resulting dset. - PROC TRANSPOSE your data back to one rec w/many vars.

If I had more time (or if you'd included code for reading in a sample dataset in your original post 8^) I'd have coded that up more concretely...

HTH,

-Roy

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of William Kossack Sent: Wednesday, April 14, 2004 3:30 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: cleaning up a dataset

except that I need it in a dataset.

my current code looks something like this &&attrib&x is a macro variable that lists all character fields (I've split off the character data for simplicity) I can create a dataset with only character data but when I go to reference &&attrib&x later I run into problems

data characterdata (keep= %do x=1 %to &amax; &&attrib&x %end;); set f;

%do x=1 %to &amax; %let value = &&attrib&x; %if &value ^= "" %then %do; drop &&attrib&x; %end; %end;

"Copeland, Laurel" wrote:

> only 1 record? this will write to the log... > DATA missingjunk; SET yourdataset; > ARRAY NUM _NUMERIC_; DO OVER NUM; IF NUM=. THEN DO; PUT NUM=; END; > END; ARRAY CH _CHARACTER_; DO OVER CH; IF CH=' ' THEN DO; PUT CH=; > END; END; RUN; > > if more than 1 record, include the id var in the PUT > PUT idvar= num=; > > hth, laurel > > -----Original Message----- > From: William Kossack [mailto:kossackw@NJC.ORG] > Sent: Wednesday, April 14, 2004 5:12 PM > To: SAS-L@LISTSERV.UGA.EDU > Subject: cleaning up a dataset > > 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


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