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

Good afternoon all,

 

I've been trying for the past couple of days to join two tables, however, I cannot join them because of different data types.

 

In one table, I have a column 'PERIOD_START_DT' (coming from a datasource that cannot be changed) with a $10. number format which reads '2015-10-25'. The other table has a column 'YrWk' with a date format MMDDYY10. which reads '04/02/2017'.

 

I need to convert PERIOD_START_DT to MMDDYY10, but I havent had any luck. First I tried chaning the format in the PROC SQL statment, then I moved to try to use a DATA step before a PROC SQL step to format it. Both were equally unsuccessful.

 

Any recommendations on how to approach this?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
art297
Opal | Level 21
data want (drop=_:);
  set have (rename=(PERIOD_START_DT=_PERIOD_START_DT));
  format PERIOD_START_DT MMDDYY10.;
  PERIOD_START_DT=input(_PERIOD_START_DT,yymmdd10.);
run;

Art, CEO, AnalystFinder.com

View solution in original post

2 REPLIES 2
art297
Opal | Level 21
data want (drop=_:);
  set have (rename=(PERIOD_START_DT=_PERIOD_START_DT));
  format PERIOD_START_DT MMDDYY10.;
  PERIOD_START_DT=input(_PERIOD_START_DT,yymmdd10.);
run;

Art, CEO, AnalystFinder.com

JBLABER
Calcite | Level 5

.... THANK YOU SO MUCH. 

 

I thought I had tried that exact same thing but clearly I didnt becasue this worked perfectly!

 

Thanks again,

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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