Help using Base SAS procedures

SAS date input

Accepted Solution Solved
Reply
Contributor
Posts: 51
Accepted Solution

SAS date input

Hello,

I am trying to input some dates using input datatement. Here is raw data:

 

 

Date

12/10/2014

1/1/2015

9/30/2015

 

As you can see, the date could be any length(10, 9, or 8), and as a result, mmddyy8. or mmddyy10. will not work.

 

Is there a way to input such mixed formated dates?

 

 

 

 

 

 

 

 


Accepted Solutions
Solution
‎11-18-2015 02:01 PM
Super User
Posts: 10,500

Re: SAS date input

data junk;
   informat date mmddyy.;
   input date;
   format date mmddyy10.;
datalines;
12/10/2014
1/1/2015
9/30/2015
;
run;

View solution in original post


All Replies
Super User
Posts: 17,819

Re: SAS date input

Try anydtdte. format
Super Contributor
Posts: 275

Re: SAS date input

data have;
 input date : anydtdte.;
 format date mmddyys10.;
 cards;
12/10/2014
1/1/2015
9/30/2015
;
Solution
‎11-18-2015 02:01 PM
Super User
Posts: 10,500

Re: SAS date input

data junk;
   informat date mmddyy.;
   input date;
   format date mmddyy10.;
datalines;
12/10/2014
1/1/2015
9/30/2015
;
run;
Contributor
Posts: 51

Re: SAS date input

Thank you all for help!
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 317 views
  • 0 likes
  • 4 in conversation