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

How can the text input date of format 2011-01-01 be converted to a mmddyy10. format?

1 ACCEPTED SOLUTION

Accepted Solutions
Haikuo
Onyx | Level 15

I am not 100% what you need, so maybe you find this helpful:

data _null_;

a='2011-01-01';

b=input(a,yymmdd10.);

format b mmddyy10.;

put 'new format=' b;

run;

Haikuo

View solution in original post

2 REPLIES 2
Haikuo
Onyx | Level 15

I am not 100% what you need, so maybe you find this helpful:

data _null_;

a='2011-01-01';

b=input(a,yymmdd10.);

format b mmddyy10.;

put 'new format=' b;

run;

Haikuo

SasNewBieEight
Calcite | Level 5

Hi Haikuo,

This is exactly what I needed... I could swear I have tried this, but kept receiving the "Invalid argument to function INPUT" error message.

data begin;

  input date $25.;

  cards;

2011-01-01

2011-01-02

;

run;

data test (drop=date);

set begin;

date2=input(date,yymmdd10.);

format date2 mmddyy10.;

put 'new format=' date2;

run;

LOG:

new format=01/01/2011

new format=01/02/201

Thanks!

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 2 replies
  • 1569 views
  • 1 like
  • 2 in conversation