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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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