Date: Tue, 24 Sep 2002 12:36:16 +0200
Reply-To: Jan Selchau-Hansen <jan@SELCHAU-HANSEN.DK>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jan Selchau-Hansen <jan@SELCHAU-HANSEN.DK>
Organization: TDC Internet
Subject: Re: formatted date to macro variable
Don't convert a SAS-date too many times, - keep the "internal" sas-value as
often as you can.
The date-formats er merely to show a sas-date in a special way.
like this.
data dat;
a='31dec2001'd;
call symput('a',put(a,5.));
run;
data dat2;
format b ddmmyy10. ;
b= &a;
run;
Jan Selchau-Hansen
"Daniele Monzali" <Daniele.Monzali@prometeia.it> wrote in message
news:ampejd$j0e$1@panco.nettuno.it...
> hello all
> i am trying to put a date value from a dataset in a macro variable for
> further use on another dataset: for example
>
> data dat;
> format a ddmmyy10.;
> a='31DEC2001'D;
> run;
>
> data _null_;
> format a ddmmyy10.;
> set dat;
> call symput('a',put(a,ddmmyy10.));
> run;
> %put &a;
>
> data dat2;
> format b ddmmyy10.;
> b="&a"D;
> run;
>
> Problem is, this block of instructions does not work since the &a
> macro-variable assumes a value given by 31/12/2001, and hence the
condition
> b="31/12/2001"D does not work in a datastep. Is there a way to put the
value
> 31DEC2001 in a macro-variable with call symput (SQL-SELECT-INTO bringing
the
> same result) or would it be straighter to employ a different instructions
in
> the dat2 data step ?
> thanks a lot
> daniele
>
> --
> Daniele Monzali, Ph.D.
> Area Financial Planning and Risk Management
> Gruppo Credit Risk
> Prometeia
> Via Marconi, 43 40122 Bologna
> Tel 0039 051 6480911
> Mobile 0039 348 4038038
>
>
>
|