BookmarkSubscribeRSS Feed
rochka84
Calcite | Level 5

format: BEST12.

informat: BEST32.

 

for both...

rochka84
Calcite | Level 5

both numeric

art297
Opal | Level 21

Have you tried the code like @Shmuel proposed, namely:

 

data want;
  set have; /*replace 'have' with whatever the filename is*/
  date = mdy(1,1,year) + day -1; 
  format date date9.;
run;

Art, CEO, AnalystFinder.com

rochka84
Calcite | Level 5

ok, i did...

now i receive colum name 'date' with numbers.

exemple: for day=1 in colum 'date'= 17532.

 

can i convert this to dd/mm/yy format?

rochka84
Calcite | Level 5

ok, i was a little foolish with my previous question.

i search some more, and put the following syntax:

 

data want5; 
set model; /*original data base*/
date = mdy(1,1,year) + day -1;
format date ddmmyy10.;
run;

 

working excelent!!!

thank you very very very much!

ballardw
Super User

May want to consider this as well:

 

date= datejul(1000*year+day);

 

What you describe is refered to as a JULIAN date, tne number of the day in a year. Typically these look like  17023  (23rd day of year 17 which should be 2017) or 2017023. When you have the year and day separately then the DATEJUL function works as above creating a single numeric value of 2017023 from 2012 and 23.

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
  • 20 replies
  • 1410 views
  • 0 likes
  • 5 in conversation