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??
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.
|