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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 951 views
  • 0 likes
  • 2 in conversation