BookmarkSubscribeRSS Feed
VALLY
Fluorite | Level 6

Good day Expects, 

 

i have 2 data set and i wanna join/compress , however they do not have a common denominator. when i run the bellow script i am only getting 5 records, and i was expecting 19m records , please assist

 

PROC SQL;
CREATE TABLE SAP_WI AS
SELECT *
'W&I' AS BU, A.*
FROM DTA.WI_ALL_BA_SAP_ACCOUNTS B
INNER JOIN VBM.SAP_BUT_MATCH A
ON INPUT(PUT(COMPRESS(INPUT(PUT(ACC_NUM,16.),$16.)||PUT(SERIAL_NUM,Z3.)),$16.),16.) = INPUT(PUT(ZZ0011,$16.),16.)
;
QUIT; 

2 REPLIES 2
ed_sas_member
Meteorite | Level 14

Hi @VALLY 

 

Could you please provide some sample data in DATALINES?

 

Best,

Kurt_Bremser
Super User

Your code as posted won't run anyway, because it misses a comma.

If you want a macro variable resolved in

'W&I' AS BU

you must use double quotes.

 

With 16 digits, you are in the area where numeric precision comes into play.

 

You concatenate a 16-digit string (result of PUT with $16.) and a 3-digit string (result of PUT with Z3.), and INPUT it with 16. That makes no sense to me. Even with the COMPRESS, once you have more than 13 digits in the first string, this will fail.

 

I suggest you do all that complicated data cleaning in a separate step first and inspect the results (use OBS= options while testing). In all your datasets, keep identification codes, serial numbers, account numbers and such as left-aligned character. Do NOT store such values as numbers. DON'T.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 501 views
  • 0 likes
  • 3 in conversation