Date: Mon, 29 Nov 2004 11:16:59 -0500
Reply-To: Jim Groeneveld <jim1stat@YAHOO.CO.UK>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jim Groeneveld <jim1stat@YAHOO.CO.UK>
Subject: Re: Variable x has been defined as both character and numeric
Hi Shankar,
I can see how difficult thing may look while starting to learn programming
SAS code and macro code (which are two different things).
Anyway, if you would like to drop variable lease_begin_date with datasets
A, B and D, you could use (and study) the code:
set &data %IF %UPCASE(&Data) NE C %THEN (DROP=lease_begin_date);;
Note the double semicolons, the first one ends the macro %IF statement and
the second one the SAS SET statement! It is assumed that the macro variable
Data can only take one of the values A, B, C or D.
I hope this help you on your learning curve ;-)
Regards - Jim.
--
Y. (Jim) Groeneveld, MSc., Biostatistician, Science Team
Vitatron B.V., Meander 1051, 6825 MJ Arnhem
P.O.Box 5227, 6802 EE Arnhem, the Netherlands
Tel: +31/0 26 376 7365, Fax: +31/0 26 376 7305
Jim.Groeneveld_AT_Vitatron.com (replace _AT_ by AT sign)
http://www.vitatron.com, http://home.hccnet.nl/jim.groeneveld
My computer multi-boots OS's, each of them adapting the DST twice a year.
[common disclaimer]
On Mon, 29 Nov 2004 21:30:09 +0530, Bhavani Shankar
<bhavani.shankar@INDIA.BIRLASOFT.COM> wrote:
>> I have a data statement as follows
>>
>> data outdata.&busname._sched&year&month
>> outdata.&busname._schedbad&year&month
>> outdata.&busname._exclusions&year&month;
>> format dateadded lease_begin_date mmddyy10. mthstomaturity 5.;
>> set &data;
>> on every iteration &Data is substituted by A , B , C ,D.
>> And i need to consider the variable lease_begin_date only when &Data
>> resolves to C (Set C)
>> and for the remaining datasets ( from SET A ,SET B and SET D) I don't
need
>> the variable lease_begin_date
>> How to drop this variable.
>> If i don't drop i am getting an error for SET A ,SET B and SET D..
>> ERROR: Variable lease_begin_date has been defined as both character and
>> numeric.
>> Thanks in advance.
>> Bhavani
>>
>>
>>
>Disclaimer: 'This email and any files transmitted with it are confidential
>and intended solely for the use of the individual or entity to whom they
are
>addressed. If you have received this email in error please notify the
system
>manager. Please note that any views or opinions presented in this email are
>solely those of the author and do not necessarily represent those of the
>company. Finally, the recipient should check this email and any attachments
>for the presence of viruses. The company accepts no liability for any
damage
>caused by any virus transmitted by this email.'
|