Dear colleagues,
I'm running proc compare on two data sets.
Code before that makes sure the variable names are the same. One of the variable is not recognised as having the same name.
I ended up naming it "X" just because you cannot really be wrong with one letter.
The procedure still shows "X" to be in file1 but not in file2 and "X" to be in file2 but not in file1. Interesting bit is that when I select the variable name in the editor it highlights both names, so the editor confirms that the text is the same.
Would you be able to advise any plan of action?
thank you
Kind regards
Marin
I'm just spitballing here, but I can only think that although your columns look like they have the same name, they are different.
Can you try something like this:
proc sql;
create table Vars as select Name from dictionary.columns where libname="SASHELP" and memname="CLASS";
quit;
data Translate;
set Vars;
HexRep = put(Name, $hex64.);
run;
Do this for both input datasets, and see if there's any difference in the hexadecimal representation of the name. I'm wondering if you've maybe got an internationalization problem.
Tom
Hi Reeza,
Unfortunately it is clients code so I wont be able to share it.
The procedure works for all other variables and for another 2 datasets I'm comparing next to these two.
I'll check with the client if I'll be able to share the code / results.
thank you
Kind regards
Marin
I'm just spitballing here, but I can only think that although your columns look like they have the same name, they are different.
Can you try something like this:
proc sql;
create table Vars as select Name from dictionary.columns where libname="SASHELP" and memname="CLASS";
quit;
data Translate;
set Vars;
HexRep = put(Name, $hex64.);
run;
Do this for both input datasets, and see if there's any difference in the hexadecimal representation of the name. I'm wondering if you've maybe got an internationalization problem.
Tom
Hi Tom,
thank you very much for the advice. The hex format revealed a character that funnily was picked up within the editor [appending itself at the end of the variable name].
I have cleared all and now everything is fine.
Thank you
Marin
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.