Joe Matise
2008-09-26 04:50:52 UTC
You want to format it (make it visually appear as a julian date) or want a
string value for the julian date?
If you mean the former, then just use the format JULIANw., so:
dateval = datepart(datetimeval);
format dateval JULIAN7.;
will take that variable in your OP (01JUN08) and convert it to 2008153 (or
whatever 01 June is in Julian), visually. It still has the 'value' behind
it of a SAS Date value, though, so if you proc export to excel or whatnot it
might or might not maintain that format (no idea).
If you need it to become a string, then you can use put:
format dateval $7.;
dateval = put(datepart(datetimeval)),JULIAN7.);
(untested) and that should put that value in a string format. Of course you
lose the ability to play with the numeric value easily at that point, but
it's the alternative.
-Joe
string value for the julian date?
If you mean the former, then just use the format JULIANw., so:
dateval = datepart(datetimeval);
format dateval JULIAN7.;
will take that variable in your OP (01JUN08) and convert it to 2008153 (or
whatever 01 June is in Julian), visually. It still has the 'value' behind
it of a SAS Date value, though, so if you proc export to excel or whatnot it
might or might not maintain that format (no idea).
If you need it to become a string, then you can use put:
format dateval $7.;
dateval = put(datepart(datetimeval)),JULIAN7.);
(untested) and that should put that value in a string format. Of course you
lose the ability to play with the numeric value easily at that point, but
it's the alternative.
-Joe
I want to convert the variable date (format datetime. ) to a Julian date.
Can some some help me with the code.
date Julian_date
01JUN08:10:57:23 ?
Thank you
Randy
Can some some help me with the code.
date Julian_date
01JUN08:10:57:23 ?
Thank you
Randy