BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
alepage
Barite | Level 11

Hello,

How do we remove (do not consider this info)  the label information into a proc compare ?

 

proc compare
 base = dim_calendrier_v1
 compare = dim_calendrier_draft;
 var 
SK_Temps
Date
.
.
.
other variables
;
run;

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

You want this ?

 

data have1 have2;
set sashelp.heart(obs=100);
run;

data have2;
set have2;
if _n_=1 then weight=1;
label Smoking_Status='XXXX';
run;


ods exclude  CompareVariables;
proc compare base=have1 compare=have2;
run;

View solution in original post

4 REPLIES 4
ChrisNZ
Tourmaline | Level 20

I don't think you can do that directly.

 

You have other options though:

 

1. Preferred option: Align the labels.

Unless there is a good reason, the same variable should have the same attributes in all data sets. Improve your DQ!

 

2. Ignore the report box labelled

 Listing of Common Variables with Differing Attributes 

 

3. Compare a view of the data sets where labels have been removed.

data T1;
  Z=1; 
  label Z='a';
run; 
data T2;
  Z=1;
  label Z='aa';
run;
 
data _V1/view=_V1;
  set T1; 
  attrib _ALL_ label=' ';
run;
data _V2/view=_V2;
  set T2;
  attrib _ALL_ label=' ';
run;

proc compare base=T1  compare=T2 ; run;
proc compare base=_V1 compare=_V2; run;

 

4. Export the results to a data set using the out= option, rather than looking at a report.

 

RichardAD
Quartz | Level 8

A third way is to use an ATTRIB statement to remove the labels from all the variables at procedure time.

 

proc compare base=have1 compare=have2;
  attrib _all_ label=' '; 
run;
WarrenKuhfeld
Ammonite | Level 13

Have you tried?

options nolabel;

I have not, but it might do what you want.

Ksharp
Super User

You want this ?

 

data have1 have2;
set sashelp.heart(obs=100);
run;

data have2;
set have2;
if _n_=1 then weight=1;
label Smoking_Status='XXXX';
run;


ods exclude  CompareVariables;
proc compare base=have1 compare=have2;
run;

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 4 replies
  • 1099 views
  • 14 likes
  • 5 in conversation