|
In article <6n87vg$463$1@nnrp1.dejanews.com>,
Jensenk@my-dejanews.com wrote:
>
> In article <1998062601155500.VAA16236@ladder03.news.aol.com>,
> dnordlund@aol.com (DNordlund) wrote:
> >
> > >I have a date in a macro variable in the format yymmdd. I need a macro
> > >variable that has 'yyyy-mm-dd' with the quotes around it.
> > >
> > >I have got to this point but can't seem to figure out how to get the
quotes
> > >around it. Any ideas? Thanks for the help.
> > >
> > >%let
> >
>newdate=19%substr(&olddate,1,2)-%substr(&olddate,3,2)-%substr(&olddate,5,2)
> > >
> >
> > Do you need to have single quotes ( 'yyyy-mm-dd') around the string, or
will
> > double quotes ("yyyy-mm-dd") work for you? If you can use the double quote
> > mark, then just place one at the beginning and end of the string like this:
<snip>
> Unfortunately, I need to have only the single quotes. Any Ideas?
I didn't realise nobody had answered this satisfactorily. Until now :-)
Once you've got your reformatted dates, as above, you can use the %sysfunc
function to access normal SAS functions, here combining Quote ( to add double
quotes) and Translate (to convert them to single quotes):
78 %let d1= 1987-12-12 ;
79 %let d2 = %sysfunc(translate(%sysfunc(quote(&d1)),"'",'"' )) ;
80 %put &d1;
1987-12-12
81 %put &d2;
'1987-12-12'
QED
Bruce
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
|