BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,
I am facing problem in julian date. when i give "2007001" as julian date, it gives "02JAN" for Date5. format. But i need the output as "01JAN" for "2007001".
Please help me to resolve this ASAP. I gave my code and output.

Data _null_;
informat k julian7.;
input julian_date julian7.;
k=2007001;
put julian_date date9.;
put "K=" k date9.;
datalines;
2007001
2008001
run;


output:-
01JAN2007
K=26DEC7454
01JAN2008
K=26DEC7454

why its working differently for datalines and assigment date value. But i need the same output for assigment date value as dataline date value. Please help me.

Thanks,
Selvi Message was edited by: Selvi
1 REPLY 1
LAP
Quartz | Level 8 LAP
Quartz | Level 8
SAS is assuming that the date you are trying to represent - 2007001 - is a numeric value for the number of days past 01Jan1960. In this case 2,007,001 days. Try using the datejul function. This will give you your desired results.

k=datejul(2007001);

> Hi,
> I am facing problem in julian date. when i give
> "2007001" as julian date, it gives "02JAN" for Date5.
> format. But i need the output as "01JAN" for
> "2007001".
> Please help me to resolve this ASAP. I gave my code
> and output.
>
> Data _null_;
> informat k julian7.;
> input julian_date julian7.;
> k=2007001;
> put julian_date date9.;
> put "K=" k date9.;
> datalines;
> 2007001
> 2008001
> run;
>
>
> output:-
> 01JAN2007
> K=26DEC7454
> 01JAN2008
> K=26DEC7454
>
> why its working differently for datalines and
> assigment date value. But i need the same output for
> assigment date value as dataline date value. Please
> help me.
>
> Thanks,
> Selvi
>
> Message was edited by: Selvi

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1527 views
  • 0 likes
  • 2 in conversation