<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: PROC COMPARE label attribute is missing in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-COMPARE-label-attribute-is-missing/m-p/982932#M379420</link>
    <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="indru1997_0-1770129077368.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112968i695635E6B571B7F0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="indru1997_0-1770129077368.png" alt="indru1997_0-1770129077368.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;i can see the labels when i run this code, but why can't i see that directly from the library? Below is the output from content porcedure. Both datasets showed same label, but i'm keeping here only one&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="indru1997_1-1770129193317.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112969i0B014B0C38069342/image-size/medium?v=v2&amp;amp;px=400" role="button" title="indru1997_1-1770129193317.png" alt="indru1997_1-1770129193317.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 03 Feb 2026 14:34:15 GMT</pubDate>
    <dc:creator>indru1997</dc:creator>
    <dc:date>2026-02-03T14:34:15Z</dc:date>
    <item>
      <title>PROC COMPARE label attribute is missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-COMPARE-label-attribute-is-missing/m-p/982660#M379366</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I have two datasets which have labels as below&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="indru1997_0-1769700663563.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112874iF5A005D100016030/image-size/medium?v=v2&amp;amp;px=400" role="button" title="indru1997_0-1769700663563.png" alt="indru1997_0-1769700663563.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;When I try to compare both these datasets, the label comparison section is not coming up as shown below,&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="indru1997_1-1769700780823.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112875i413B5D57C299874B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="indru1997_1-1769700780823.png" alt="indru1997_1-1769700780823.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Does anyone know how to solve this?&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jan 2026 15:33:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-COMPARE-label-attribute-is-missing/m-p/982660#M379366</guid>
      <dc:creator>indru1997</dc:creator>
      <dc:date>2026-01-29T15:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: PROC COMPARE label attribute is missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-COMPARE-label-attribute-is-missing/m-p/982666#M379367</link>
      <description>&lt;P&gt;Are you sure you have labels for the datasets compared?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For me it works:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sbxkoenk_0-1769702314662.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112877iE60F3CC575C66CDC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sbxkoenk_0-1769702314662.png" alt="sbxkoenk_0-1769702314662.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What if you do a &lt;STRONG&gt;PROC CONTENTS&lt;/STRONG&gt;?&lt;/P&gt;
&lt;P&gt;In the very first output table (Results) ... do you see your label?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sbxkoenk_1-1769702398656.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112878i29C6FC45202CE55E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sbxkoenk_1-1769702398656.png" alt="sbxkoenk_1-1769702398656.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Ciao,&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jan 2026 16:01:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-COMPARE-label-attribute-is-missing/m-p/982666#M379367</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2026-01-29T16:01:22Z</dc:date>
    </item>
    <item>
      <title>Re: PROC COMPARE label attribute is missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-COMPARE-label-attribute-is-missing/m-p/982669#M379368</link>
      <description>&lt;P&gt;&lt;SPAN&gt;per the doc: &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;Note: The COMPARE procedure omits data set labels if the line size is too small for them.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I guess you have an enormous lot of trailing blanks in your label ! Please trim the label!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[EDIT] ... or augment the line size with the linesize option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Koen&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jan 2026 21:57:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-COMPARE-label-attribute-is-missing/m-p/982669#M379368</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2026-01-29T21:57:24Z</dc:date>
    </item>
    <item>
      <title>Re: PROC COMPARE label attribute is missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-COMPARE-label-attribute-is-missing/m-p/982689#M379369</link>
      <description>&lt;P&gt;You&amp;nbsp; can check the current Linesize and then increase it.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc options option=linesize;
run;

options linesize=120;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Jan 2026 18:32:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-COMPARE-label-attribute-is-missing/m-p/982689#M379369</guid>
      <dc:creator>Kathryn_SAS</dc:creator>
      <dc:date>2026-01-29T18:32:24Z</dc:date>
    </item>
    <item>
      <title>Re: PROC COMPARE label attribute is missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-COMPARE-label-attribute-is-missing/m-p/982695#M379370</link>
      <description>&lt;P&gt;Check your LINESIZE setting.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With LINESIZE set to 132 (normal line printer carriage length) it will display labels up to 72 bytes long.&lt;/P&gt;
&lt;PRE&gt; 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;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2026-01-29 at 5.14.16 PM.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112889i5B24DD6D01706F10/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2026-01-29 at 5.14.16 PM.png" alt="Screenshot 2026-01-29 at 5.14.16 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;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.&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;PRE&gt; 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(&amp;amp;dsn,i));
 81         %put &amp;amp;=dsn LABEL="%sysfunc(attrc(&amp;amp;dsid,label))";
 DSN=test1 LABEL="NoTrailing"
 82         %let dsn=test2;
 83         %let dsid=%sysfunc(open(&amp;amp;dsn,i));
 84         %put &amp;amp;=dsn LABEL="%sysfunc(attrc(&amp;amp;dsid,label))";
 DSN=test2 LABEL="Trailing  "
 85         %let dsid=%sysfunc(close(&amp;amp;dsid));&lt;/PRE&gt;
&lt;P&gt;So if you are defining the labels using quoted strings make sure not to include the trailing spaces.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are creating macro variables to generate the LABEL then take care not to add trailing spaces into the macro variable.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Always use the modern CALL SYMPUTX() method instead of the ancient CALL SYMPUT() method&lt;/LI&gt;
&lt;LI&gt;In PROC SQL add the TRIMMED option to your INTO clause.&lt;/LI&gt;
&lt;LI&gt;If adding the quotes into the value make sure to use TRIM() function before adding the quotes.&amp;nbsp; (quote(trim(label))&lt;/LI&gt;
&lt;LI&gt;If writing the code to a file using PUT statement make sure to add the : modifier.&amp;nbsp; PUT LABEL :$quote. ;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jan 2026 23:37:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-COMPARE-label-attribute-is-missing/m-p/982695#M379370</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2026-01-29T23:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: PROC COMPARE label attribute is missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-COMPARE-label-attribute-is-missing/m-p/982750#M379385</link>
      <description>&lt;P&gt;For what very little it may be worth, I tend to create output data sets for Proc Compare and then write a custom report for anything except nearly trivial Proc Compare output because the procedure is quite often not very nice. With a data set then I can use all of the options provided by Proc Print or Report to make sure the appearance is as desired.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jan 2026 16:23:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-COMPARE-label-attribute-is-missing/m-p/982750#M379385</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2026-01-30T16:23:15Z</dc:date>
    </item>
    <item>
      <title>Re: PROC COMPARE label attribute is missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-COMPARE-label-attribute-is-missing/m-p/982920#M379416</link>
      <description>&lt;P&gt;I even tried using a different dataset, and also set the linesize=256. But still no change.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="indru1997_0-1770123569763.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112963i04C94B77A3B79980/image-size/medium?v=v2&amp;amp;px=400" role="button" title="indru1997_0-1770123569763.png" alt="indru1997_0-1770123569763.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13770"&gt;@Kathryn_SAS&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/60547"&gt;@sbxkoenk&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;For your information, I'm running this procedure inside a clinical study, so is there anything that suppresses this label? Because when I run using sashelp.class&amp;nbsp; dataset, i can see the labels.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Feb 2026 13:09:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-COMPARE-label-attribute-is-missing/m-p/982920#M379416</guid>
      <dc:creator>indru1997</dc:creator>
      <dc:date>2026-02-03T13:09:42Z</dc:date>
    </item>
    <item>
      <title>Re: PROC COMPARE label attribute is missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-COMPARE-label-attribute-is-missing/m-p/982922#M379418</link>
      <description>&lt;P&gt;Can you send a PROC CONTENTS of each data set? Can you run the following as a test to see if you see the labels?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc contents data=adam.adlb;
run;

proc contents data=qcadam.adlb;
run;

data one(label='HH');
x=1;
run;

data two(label='Demographics');
x=2;
run;

options label linesize=256;
proc compare base=one compare=two;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Feb 2026 13:14:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-COMPARE-label-attribute-is-missing/m-p/982922#M379418</guid>
      <dc:creator>Kathryn_SAS</dc:creator>
      <dc:date>2026-02-03T13:14:35Z</dc:date>
    </item>
    <item>
      <title>Re: PROC COMPARE label attribute is missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-COMPARE-label-attribute-is-missing/m-p/982932#M379420</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="indru1997_0-1770129077368.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112968i695635E6B571B7F0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="indru1997_0-1770129077368.png" alt="indru1997_0-1770129077368.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;i can see the labels when i run this code, but why can't i see that directly from the library? Below is the output from content porcedure. Both datasets showed same label, but i'm keeping here only one&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="indru1997_1-1770129193317.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112969i0B014B0C38069342/image-size/medium?v=v2&amp;amp;px=400" role="button" title="indru1997_1-1770129193317.png" alt="indru1997_1-1770129193317.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Feb 2026 14:34:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-COMPARE-label-attribute-is-missing/m-p/982932#M379420</guid>
      <dc:creator>indru1997</dc:creator>
      <dc:date>2026-02-03T14:34:15Z</dc:date>
    </item>
    <item>
      <title>Re: PROC COMPARE label attribute is missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-COMPARE-label-attribute-is-missing/m-p/982934#M379421</link>
      <description>&lt;P&gt;Which output destination are you using? Please send your log so that we can see the exact code you are running and add the following before the PROC COMPARE step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc options option=linesize;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Feb 2026 14:42:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-COMPARE-label-attribute-is-missing/m-p/982934#M379421</guid>
      <dc:creator>Kathryn_SAS</dc:creator>
      <dc:date>2026-02-03T14:42:07Z</dc:date>
    </item>
    <item>
      <title>Re: PROC COMPARE label attribute is missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-COMPARE-label-attribute-is-missing/m-p/982969#M379422</link>
      <description>&lt;P&gt;How long are your actual labels? And your dataset names since they are both displayed on the same line in the PROC COMPARE output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the ATTRC() function as I showed to check if your labels have been defined with multiple trailing spaces.&amp;nbsp; If doing it in data step it takes a little work to notice the trailing spaces.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test1(label='NoTrailing')
     test2(label='Trailing  ')
;
  x=1;
run;

data check;
  length memname $32 len lenn 8 label $300 ;
  do memname='test1','test2';
    dsid=open(memname);
    label=quote(attrc(dsid,'label'));
    len=length(dequote(label));
    lenn=lengthn(translate(dequote(label),'.',' '));
    dsid=close(dsid);
    output;
  end;
  drop dsid;
run;

data _null_;
  set check;
  put (memname len lenn label) (=);
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results show that the trailing spaces are actually stored in the metadata of the dataset.&lt;/P&gt;
&lt;PRE&gt; memname=test1 len=10 lenn=10 label="NoTrailing"
 memname=test2 len=8 lenn=10 label="Trailing  "&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Feb 2026 17:37:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-COMPARE-label-attribute-is-missing/m-p/982969#M379422</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2026-02-03T17:37:32Z</dc:date>
    </item>
    <item>
      <title>Re: PROC COMPARE label attribute is missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-COMPARE-label-attribute-is-missing/m-p/983073#M379453</link>
      <description>&lt;P&gt;thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when i checked the length using your code, i found that the trailing space are more than what is apparent in the proc contents&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="indru1997_0-1770267581432.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/113025iE748C190DD1FD97E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="indru1997_0-1770267581432.png" alt="indru1997_0-1770267581432.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Do you know how to trim this, because in proc sql i'm not adding any space.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="indru1997_1-1770267707217.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/113026i175503154C17372A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="indru1997_1-1770267707217.png" alt="indru1997_1-1770267707217.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Feb 2026 05:01:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-COMPARE-label-attribute-is-missing/m-p/983073#M379453</guid>
      <dc:creator>indru1997</dc:creator>
      <dc:date>2026-02-05T05:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: PROC COMPARE label attribute is missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-COMPARE-label-attribute-is-missing/m-p/983085#M379460</link>
      <description>&lt;P&gt;The code in your second picture will not add any spaces to the end of the label in for the dataset DM.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I suspect you are doing is trying to use some metadata to generate the code.&amp;nbsp; So perhaps you have a dataset with MEMNAME and MEMLABEL and you are using it to generate that code with LABEL= dataset option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you use macro variables to generate the code.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&amp;amp;dsname(label="&amp;amp;dslabel")&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then make sure that the macro variables do not have trailing spaces in them.&amp;nbsp; So make sure to use CALL SYMPUTX() instead of the ancient CALL SYMPUT().&amp;nbsp; NOTE: You should only be using CALL SYMPUT() if it is important to include leading/trailing spaces in the generated macro variables.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;call symputx('dsname',memname);
call symputx('dslabel',memlabel);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or if you are using SQL use the TRIMMED keyword.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select memname,memlabel
  into :dsname trimmed
     , :dslabel trimmed
  from ...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you use a data step to write the code to a file then make sure not to write the trailing spaces.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;put memname '(label=' memlabel :$quote. ')' ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also you might want to use the QUOTE() function to add the quotes.&amp;nbsp; That way you can use the optional second parameter so that the value is quoted using single quotes so that any % or &amp;amp; characters in the member label are not acted on by the macro processor.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;call symputx('dslabel',quote(trim(memlabel),"'"));
...
&amp;amp;dsname(label=&amp;amp;dslabel)
...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NOTE: It is also possible that the metadata used to generate the label has other invisible characters instead of spaces.&amp;nbsp; So check that also.&amp;nbsp; Common things to check for are tabs ('09'x) and non-breaking spaces ('A0'x). Or end of line characters carriage return ('0D'x) or line feed ('0A'x).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;memlabel=translate(memlabel,'    ','09A00D0A'x);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Feb 2026 14:53:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-COMPARE-label-attribute-is-missing/m-p/983085#M379460</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2026-02-05T14:53:36Z</dc:date>
    </item>
    <item>
      <title>Re: PROC COMPARE label attribute is missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-COMPARE-label-attribute-is-missing/m-p/983248#M379472</link>
      <description>&lt;P&gt;sure, will try this&lt;/P&gt;&lt;P&gt;Thank you again!&lt;/P&gt;</description>
      <pubDate>Tue, 10 Feb 2026 10:04:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-COMPARE-label-attribute-is-missing/m-p/983248#M379472</guid>
      <dc:creator>indru1997</dc:creator>
      <dc:date>2026-02-10T10:04:03Z</dc:date>
    </item>
  </channel>
</rss>

