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.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 20 replies
  • 2943 views
  • 0 likes
  • 5 in conversation