Hi all,
I have two datasets which have labels as below
When I try to compare both these datasets, the label comparison section is not coming up as shown below,
Does anyone know how to solve this?
Are you sure you have labels for the datasets compared?
For me it works:
What if you do a PROC CONTENTS?
In the very first output table (Results) ... do you see your label?
Ciao,
Koen
per the doc:
Note: The COMPARE procedure omits data set labels if the line size is too small for them.
I guess you have an enormous lot of trailing blanks in your label ! Please trim the label!
[EDIT] ... or augment the line size with the linesize option.
Cheers,
Koen
You can check the current Linesize and then increase it.
proc options option=linesize;
run;
options linesize=120;
Check your LINESIZE setting.
With LINESIZE set to 132 (normal line printer carriage length) it will display labels up to 72 bytes long.
73 %put linesize=%sysfunc(getoption(ls)); linesize=132 74 data one(label='First') two(label="%substr(%sysfunc(repeat(Second,20)),1,72)"); 75 set sashelp.class; 76 run;
NOTE: PROC COMPARE (or perhaps the actual way that labels are stored in the SAS dataset) treats trailing spaces differently than the rest of SAS treats them.
73 data test1(label='NoTrailing')
74 test2(label='Trailing ')
75 ;
76 x=1;
77 run;
NOTE: The data set WORK.TEST1 has 1 observations and 1 variables.
NOTE: The data set WORK.TEST2 has 1 observations and 1 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.01 seconds
78
79 %let dsn=test1;
80 %let dsid=%sysfunc(open(&dsn,i));
81 %put &=dsn LABEL="%sysfunc(attrc(&dsid,label))";
DSN=test1 LABEL="NoTrailing"
82 %let dsn=test2;
83 %let dsid=%sysfunc(open(&dsn,i));
84 %put &=dsn LABEL="%sysfunc(attrc(&dsid,label))";
DSN=test2 LABEL="Trailing "
85 %let dsid=%sysfunc(close(&dsid));
So if you are defining the labels using quoted strings make sure not to include the trailing spaces.
If you are creating macro variables to generate the LABEL then take care not to add trailing spaces into the macro variable.
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.