I am using the follwing proc compare. But I am seeing the difference of Variable length in Result viewer, can we avoid with any option or statements. I tried this.
proc compare base=have comp=want listall ;
informat _all_;
format _all_;
attrib _all_
label=' ';
run;
data have; length name $ 40; set sashelp.class; run; ods exclude CompareVariables; proc compare base=sashelp.class comp=have listall ; informat _all_; format _all_; attrib _all_ label=' '; run;
data have; length name $ 40; set sashelp.class; run; ods exclude CompareVariables; proc compare base=sashelp.class comp=have listall ; informat _all_; format _all_; attrib _all_ label=' '; run;
Why would you want that?
You could exclude that whole part of the output, but then you would miss other information that is printed there.
Example:
data have(drop=long) want(drop=name rename=(long=name));
length long $20;
set sashelp.class;
long=name;
output have;
if _n_=1 then age=9;
output want;
run;
ods trace on;
ods exclude CompareVariables ;
proc compare data=have compare=want;
run;
ods exclude none;
ods trace off;
I am comparing the table calculated values done by someone else, variable lengths are not important to compare. I was interested in actual values present in data. when I see so many variables with length differences, it kind of annoying ( I am aware sas presents it for a reason). In this case variable lengths are not important to compare.
Thank you Ksharp and Tom. Both given the same answers which worked for me. I don't know How I can accept both as solutions. So I selected first one. Sorry Tom🙏
You could also just check the SYSINFO macro variable that PROC COMPARE generates and ignore the bits that indicate the variable attribute differences you don't care about.
https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n1jbbrf1tztya8n1tju77t35dej9.htm
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.
Ready to level-up your skills? Choose your own adventure.