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

Catch up on SAS Innovate 2026

Dive into keynotes, announcements and breakthroughs on demand.

Explore 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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 20 replies
  • 6919 views
  • 1 like
  • 5 in conversation