BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Reeza
Super User

That's not making sense. Please post your proc contents. 

Bal23
Lapis Lazuli | Level 10

93

var1Num8 

# Variable Type Len Format Informat Label 6

var2Char4   
Reeza
Super User

No formats?

What does each one of those variables look like - to make sure?

 

Bal23
Lapis Lazuli | Level 10

var1  0234     0389      0423

 

var2   234       389        423

Reeza
Super User

data one;
input var1;
cards;
123
456
789
234
;
run;

data two;
input var2 $;
cards;
0123
0456
0789
234
;
run;

data two_formatted;
set two;
var1=input(var2, best12.);
run;

proc sort data=one; by var1; run;
proc sort data=two_formatted; by var1; run;

data merged;
merge one two_formatted;
by var1;
run;

Peter_C
Rhodochrosite | Level 12
In sql a join could convert the char to num
On input( table1.leadz, best15.) = inpur( table2.nolead, best15.)

But that join fails when the input function returns missing for unsuitable strings

To achieve similar results on a data step merge the numeric form of these values need to be converted in steps before the merge.
I/O impact can be minimised by these prior steps creating table1 and table2 as views

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 20 replies
  • 1340 views
  • 1 like
  • 5 in conversation