BookmarkSubscribeRSS Feed
radha1
Calcite | Level 5

Hi Team, 

 

I am trying to compare the same data in the string columns, if it's not equal then return F, if it's equal then retun T using below code , even if the data in the columns are similar, including their lengths

 

 

proc sql;
create table TEstst as
select 
CODE_UNIT_old , CODE_UNIT,length(CODE_UNIT_old ),length(CODE_UNIT),
case when CODE_UNIT_old ne CODE_UNIT then 'T'
else 'F'
end as result
from MISMATCH
;
quit;

ans then am printing in a HTML , if the data is mimatch then highlight ,  with below code 

 

 

COMPUTE CODE_UNIT_old;

IF ( strip(CODE_UNIT_old) ne strip(CODE_UNIT) ) then
call define (_col_,"style","style={background= orange}");
ENDCOMP;

 

But  all rows are highlithed even if they have identical data .

 

CODE_UNIT_old CODE_UNIT           length_0ld length_new result
Fix 1,75%                Fix 1,75%                    9                    9           T
Fix 2,25%                Fix 2,25%                  9                     9          T

 

Can some one help this issue.

1 REPLY 1
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Its probably because your specifying _col_ in the define.  Hard to say from snippets of code in shouting language.  As simpler method would be to create a format and use that, as described in:

http://support.sas.com/resources/papers/proceedings11/290-2011.pdf

You wouldn't need all the compute parts then.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 1 reply
  • 791 views
  • 0 likes
  • 2 in conversation