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 2009, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Sat, 4 Apr 2009 13:24:16 -0400
Reply-To:   msz03@albany.edu
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Mike Zdeb <msz03@ALBANY.EDU>
Subject:   Re: Conditional Column Drop
Content-Type:   text/plain;charset=iso-8859-1

hi ... just to add one comment to what's been posted so far ...

data steps comprise two types of statements ... declarative and executable

the declarative statements take place at compile time the executable statements take place at execution time

your statement ... if column=. then drop;

mixes two types of statements ... not allowed !!!

IF-THEN is EXECUTBLE DROP is DECLARATIVE

take a look at ... DATA Step Statements: Executable and Declarative Statements

http://tinyurl.com/data-step-statements

as for what you are really trying to do, as has been pointed out, if you want to get rid of an observation (ROW) at execution time, that's easy ... IF-THEN-DELETE (all executable)

if you want to get rid of a variable (COLUMN) if any values of that variable are missing, that's more difficult ... you'll have to read/write the entire data set based on finding a missing value

one possible way ... replace your 'IF-THEN-DROP' with the 'IF-THEN-DO' shown below

data test; input x y @@; datalines; 1 2 3 . 5 6 7 8 9 10 ; run;

data _null_; set test; if y eq . then do; call execute ('data test; set test (drop=y); run;'); stop; end; run;

-- Mike Zdeb U@Albany School of Public Health One University Place Rensselaer, New York 12144-3456 P/518-402-6479 F/630-604-1475

> i am trying to do something such as > > data new; > set old; > if column=. then drop; > run; > > this does not work, but translates the basic concept of my goal. > any help would be great. > thanks > >


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