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

How do I convert dates of this form 10/27/2006 to numeric? some dates are 2/2/2006?

1 ACCEPTED SOLUTION

Accepted Solutions
stat_sas
Ammonite | Level 13

If I understood it correctly, you need number equivalent to the date then please try this.

data have;

input date mmddyy10.;

format  date mmddyy10.;

date_number=date;

datalines;

10/27/2006

;

View solution in original post

5 REPLIES 5
stat_sas
Ammonite | Level 13

If I understood it correctly, you need number equivalent to the date then please try this.

data have;

input date mmddyy10.;

format  date mmddyy10.;

date_number=date;

datalines;

10/27/2006

;

desireatem
Pyrite | Level 9

I do not understand, the data is imported from excel, the variable name is date.

Just as you said I need number equivalent to the date then please try this.

stat_sas
Ammonite | Level 13

What is the type of date variable? Are you looking to convert char date variable into numeric or just need to know number which represents 10/27/2006?

desireatem
Pyrite | Level 9

A number 10/27/2006

stat_sas
Ammonite | Level 13

What is the desired output?

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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