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 (August 2005, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 12 Aug 2005 06:20:13 -0700
Reply-To:     Ali G <Alistair.Gordon@NEWTYNE.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Ali G <Alistair.Gordon@NEWTYNE.COM>
Organization: http://groups.google.com
Subject:      Re: Conditional statement based on whether or not variable name
              is on dataset??
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset="iso-8859-1"

Hi Julie,

I would use a macro to do this and it would look something like:

%macro sal; data a; set b; %let dsid = %sysfunc(open(b)); %* find will be 0 if there is no variable called ID in the data ; %let find = %sysfunc(varnum(&dsid,ID)); %let rc = %sysfunc(close(&dsid));

%if &find ne 0 %then %do; salary = salary * 2; %end; run; %mend sal;

N.B. I haven't tested this code!

Regards,

Alistair.


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