DATA Step, Macro, Functions and more

Julian to YYYY-DD-MM

Accepted Solution Solved
Reply
Super Contributor
Posts: 673
Accepted Solution

Julian to YYYY-DD-MM

How to convert Julian date to YYYY-DD-MM

data t;

t=2013231;

t2=2013224;

  run;


Accepted Solutions
Solution
‎08-20-2013 01:12 AM
Trusted Advisor
Posts: 1,137

Re: Julian to YYYY-DD-MM

I used the function datejul() which converts julian date to a sas date value and then used the format yymmdd10.  Need to check if there is format for yyddmm. Else we need to separate the month and day from the date and then concatenate them into yyddmm. if there is any other way , would like to know it

data t;

t=2013231;

t2=2013224;

t_=DATEJUL(t);

t2_=DATEJUL(t2);

format t_ t2_  yymmdd10.;

  run;

Thanks,

Jagadish

Thanks,
Jag

View solution in original post


All Replies
Super Contributor
Posts: 307

Re: Julian to YYYY-DD-MM

You can convert a Julian date to a SAS date value with the DATEJUL function.

data t;

format date1 date2 yymmdd10.;

t=2013231;

t2=2013224;

date1=datejul(t);

date2=dateful(t2);

;

run;

Solution
‎08-20-2013 01:12 AM
Trusted Advisor
Posts: 1,137

Re: Julian to YYYY-DD-MM

I used the function datejul() which converts julian date to a sas date value and then used the format yymmdd10.  Need to check if there is format for yyddmm. Else we need to separate the month and day from the date and then concatenate them into yyddmm. if there is any other way , would like to know it

data t;

t=2013231;

t2=2013224;

t_=DATEJUL(t);

t2_=DATEJUL(t2);

format t_ t2_  yymmdd10.;

  run;

Thanks,

Jagadish

Thanks,
Jag
🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 908 views
  • 5 likes
  • 3 in conversation