BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
LL5
Pyrite | Level 9 LL5
Pyrite | Level 9

I have a column calls as_of_date which is a character filed and the format is yyyy-mm-dd like 2020-05-01. How do I convert it to numeric?

I tried input(as_of_date, DDMMYY10.) and several of other formats but they did not work.

Thanks.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20
data test;
    dt1 = '2020-05-01';
    dt2 = input(dt1, yymmdd10.);
    format dt2 yymmdd10.;
run;

View solution in original post

3 REPLIES 3
PeterClemmensen
Tourmaline | Level 20
data test;
    dt1 = '2020-05-01';
    dt2 = input(dt1, yymmdd10.);
    format dt2 yymmdd10.;
run;
ballardw
Super User

Hint in reading informat and format descriptions:

YY = year  (2 or 4 digits)

MM = month number

DD = day of month number

 

So when your data is in year month day order it becomes a bit more obvious that you want some form of YYMMDD informat/format.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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
  • 3 replies
  • 47345 views
  • 5 likes
  • 4 in conversation