<?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: SAS Columnlabels in Excel via library in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Columnlabels-in-Excel-via-library/m-p/863166#M340980</link>
    <description>&lt;P&gt;There is no global DBLABEL= dataset option, see &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/ledsoptsref/p1pczmnhbq4axpn1l15s9mk6mobp.htm" target="_blank" rel="noopener"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;The DBLABEL= dataset option you want to use can only be used with a LIBNAME for the PC Files Server or relational databases.&lt;/P&gt;</description>
    <pubDate>Thu, 09 Mar 2023 11:53:59 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2023-03-09T11:53:59Z</dc:date>
    <item>
      <title>SAS Columnlabels in Excel via library</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Columnlabels-in-Excel-via-library/m-p/863150#M340974</link>
      <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;Is it possible to output the column labels of a dataset via xlsx Libname? I can use the label output via proc export and ods excel. But i seem to miss something with the libname statement...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%let useColumnlabels = false;

%macro ExportDatasetInFileExcel(
        paraDirectory /*string*/
        , paraFilename /*string*/
        , paraWorksheetName /*string*/
        , paraDataSetName /*string*/
        , paraUseColumnLabels = &amp;amp;useColumnlabels. /*string true false */
    );

    libname refFile xlsx "&amp;amp;paraDirectory./&amp;amp;paraFilename..&amp;amp;outputFileExtensionExcel.";

    %if &amp;amp;paraUseColumnLabels. = true %then %do;
        data refFile.&amp;amp;paraWorksheetName.
                (DBLABEL = yes)
            ;
            set &amp;amp;paraDataSetName.;
        run;
    %end;
    %else %do;
        data refFile.&amp;amp;paraWorksheetName.;
            set &amp;amp;paraDataSetName.;
        run;
    %end;

    libname refFile clear;
%mend ExportDatasetInFileExcel;


data Example_DataSet_Labels;
  set sashelp.class;
  label name="Very  very very very very very long name of a very very very long string";
run;

%ExportDatasetInFileExcel(
    /home/sasserver/mypath
    , Filename
    , Workbook
    , Example_DataSet_Labels
    , paraUseColumnLabels = true
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried the code above but got the following error&lt;/P&gt;&lt;P&gt;22: LINE and COLUMN cannot be determined.&lt;/P&gt;&lt;P&gt;NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where the error has occurred.&lt;/P&gt;&lt;P&gt;ERROR 22-7: Invalid option name DBLABEL.&lt;/P&gt;&lt;P&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 09 Mar 2023 10:33:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Columnlabels-in-Excel-via-library/m-p/863150#M340974</guid>
      <dc:creator>Yjn000</dc:creator>
      <dc:date>2023-03-09T10:33:05Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Columnlabels in Excel via library</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Columnlabels-in-Excel-via-library/m-p/863160#M340978</link>
      <description>&lt;P&gt;Like always first make your SAS code fully work before you wrap a macro around it.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname refFile xlsx "c:\temp\test.xlsx";
data refFile.Example_DataSet_Labels(DBLABEL = yes);
  set sashelp.class;
  label sex="Use Gender instead of Sex";
run;
libname refFile clear;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1678360158910.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/81250iACBA74287E21C4F9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1678360158910.png" alt="Patrick_0-1678360158910.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once you know the SAS code works you can make it dynamic because now you know that any error you get is because of the macro "stuff" you're adding.&lt;/P&gt;
&lt;P&gt;Below works for me.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro ExportDatasetInFileExcel(
        paraDirectory /*string*/
        , paraFilename /*string*/
        , paraWorksheetName /*string*/
        , paraDataSetName /*string*/
        , paraUseColumnLabels = false /*string true false */
    );

    libname refFile xlsx "&amp;amp;paraDirectory./&amp;amp;paraFilename";

    data refFile.&amp;amp;paraWorksheetName.
      %if %upcase(&amp;amp;paraUseColumnLabels)= TRUE %then
        %do;
          (DBLABEL = yes)
        %end;
        ;
      set &amp;amp;paraDataSetName.;
    run;

    libname refFile clear;
%mend ExportDatasetInFileExcel;


data Example_DataSet_Labels;
  set sashelp.class;
  label name="Very  very very very very very long name of a very very very long string";
run;

%ExportDatasetInFileExcel(
    c:\temp
    , test.xlsx
    , my_sheet
    , Example_DataSet_Labels
    , paraUseColumnLabels = true
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2023 11:25:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Columnlabels-in-Excel-via-library/m-p/863160#M340978</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-03-09T11:25:35Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Columnlabels in Excel via library</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Columnlabels-in-Excel-via-library/m-p/863166#M340980</link>
      <description>&lt;P&gt;There is no global DBLABEL= dataset option, see &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/ledsoptsref/p1pczmnhbq4axpn1l15s9mk6mobp.htm" target="_blank" rel="noopener"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;The DBLABEL= dataset option you want to use can only be used with a LIBNAME for the PC Files Server or relational databases.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2023 11:53:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Columnlabels-in-Excel-via-library/m-p/863166#M340980</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-03-09T11:53:59Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Columnlabels in Excel via library</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Columnlabels-in-Excel-via-library/m-p/863169#M340982</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;There is no global DBLABEL= dataset option, see &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/ledsoptsref/p1pczmnhbq4axpn1l15s9mk6mobp.htm" target="_blank" rel="noopener"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;The DBLABEL= dataset option you want to use can only be used with a LIBNAME for the PC Files Server or relational databases.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp; The option is not global as you state but the SAS docu still calls it a dataset option:&amp;nbsp;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/acpcref/p0rptbtkast6len1uzzxwj56vwhka.htm" target="_self"&gt;DBLABEL= Data Set Option&lt;/A&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options obs=1;
libname refFile xlsx "c:\temp\test.xlsx";
data refFile.Sheet_Using_Label(DBLABEL = yes);
  set sashelp.class;
  label sex="Use Gender instead of Sex";
run;
data refFile.Sheet_Using_Varname(DBLABEL = no);
  set sashelp.class;
  label sex="Use Gender instead of Sex";
run;

proc print data=refFile.Sheet_Using_Label;
run;
proc print data=refFile.Sheet_Using_Varname;
run;
libname refFile clear;
options obs=max;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1678363145564.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/81252iB61B7ECB7EBBB9D4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1678363145564.png" alt="Patrick_0-1678363145564.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2023 12:02:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Columnlabels-in-Excel-via-library/m-p/863169#M340982</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-03-09T12:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Columnlabels in Excel via library</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Columnlabels-in-Excel-via-library/m-p/863397#M341062</link>
      <description>&lt;P&gt;Hi Patrick,&lt;/P&gt;&lt;P&gt;thanks for your response.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Both your code examples with and without macro throw the same error as mine example.&lt;BR /&gt;Furthermore I reviewed your code and couldn't find any important difference to mine.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2023 10:33:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Columnlabels-in-Excel-via-library/m-p/863397#M341062</guid>
      <dc:creator>Yjn000</dc:creator>
      <dc:date>2023-03-10T10:33:43Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Columnlabels in Excel via library</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Columnlabels-in-Excel-via-library/m-p/863399#M341064</link>
      <description>&lt;P&gt;Hi i tried to follow these offical sas documentations&lt;BR /&gt;&lt;A title="SAS Docu SAS9.4" href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/acreldb/p1aksmchxr4bekn1bdxjk4isnvna.htm" target="_blank" rel="noopener"&gt;SAS Docu SAS9.4&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A title="SAS Docu Viya" href="https://documentation.sas.com/doc/en/pgmsascdc/v_036/acpcref/p0rptbtkast6len1uzzxwj56vwhk.htm" target="_blank" rel="noopener"&gt;SAS Docu Viya&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2023 10:44:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Columnlabels-in-Excel-via-library/m-p/863399#M341064</guid>
      <dc:creator>Yjn000</dc:creator>
      <dc:date>2023-03-10T10:44:40Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Columnlabels in Excel via library</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Columnlabels-in-Excel-via-library/m-p/863400#M341065</link>
      <description>&lt;P&gt;Please post the&amp;nbsp;&lt;EM&gt;complete&lt;/EM&gt; (all code and messages) of the non-macro code that resulted in the error.&lt;/P&gt;
&lt;P&gt;Copy/paste the log text into a window opened with this button:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/54552i914D97BE1B0F21E5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2023 10:52:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Columnlabels-in-Excel-via-library/m-p/863400#M341065</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-03-10T10:52:08Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Columnlabels in Excel via library</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Columnlabels-in-Excel-via-library/m-p/863406#M341067</link>
      <description>&lt;P&gt;Just to clarify here is the code i am having troubles with&lt;/P&gt;&lt;PRE&gt;libname refFile xlsx "/home/Playground/myFile_Label.xlsx";

data refFile.Example_DataSet_Labels (dblabel = yes);
	set sashelp.class;
	label name="Very  very very very very very long name of a very very very long string";
run;

libname refFile clear;&lt;/PRE&gt;&lt;P&gt;and here is the generated log&lt;/P&gt;&lt;PRE&gt;1                                                          The SAS System                         Friday, March 10, 2023 08:46:00 AM

1          ;*';*";*/;quit;run;
2          OPTIONS PAGENO=MIN;
3          %LET _CLIENTTASKLABEL='z_02_CodeInDevelopment_Snippets';
4          %LET _CLIENTPROCESSFLOWNAME='Playground';
5          %LET _CLIENTPROJECTPATH='Z:\Playground\Example.egp';
6          %LET _CLIENTPROJECTPATHHOST='MYSERVER';
7          %LET _CLIENTPROJECTNAME='Example.egp';
8          %LET _SASPROGRAMFILE='';
9          %LET _SASPROGRAMFILEHOST='';
10         
11         ODS _ALL_ CLOSE;
12         OPTIONS DEV=PNG;
13         GOPTIONS XPIXELS=0 YPIXELS=0;
14         %macro HTML5AccessibleGraphSupported;
15             %if %_SAS_VERCOMP_FV(9,4,4, 0,0,0) &amp;gt;= 0 %then ACCESSIBLE_GRAPH;
16         %mend;
17         FILENAME EGXLSSX TEMP;
18         ODS EXCEL(ID=EGXLSSX) FILE=EGXLSSX AUTHOR="********" STYLE=Excel
19         OPTIONS (
20          EMBEDDED_TITLES="yes" EMBEDDED_FOOTNOTES="yes"
21         );
22         
23         libname refFile xlsx "/home/Playground/myFile_Label.xlsx";
NOTE: Libref REFFILE was successfully assigned as follows: 
      Engine:        XLSX 
      Physical Name: /home/Playground/myFile_Label.xlsx
24         
25         data refFile.Example_DataSet_Labels (dblabel = yes);
                                                _______
                                                22
ERROR 22-7: Invalid option name DBLABEL.

26         	set sashelp.class;
27         	label name="Very  very very very very very long name of a very very very long string";
28         run;

NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

29         
30         libname refFile clear;
NOTE: Libref REFFILE has been deassigned.
31         
32         %LET _CLIENTTASKLABEL=;
33         %LET _CLIENTPROCESSFLOWNAME=;
34         %LET _CLIENTPROJECTPATH=;
35         %LET _CLIENTPROJECTPATHHOST=;
36         %LET _CLIENTPROJECTNAME=;
37         %LET _SASPROGRAMFILE=;
38         %LET _SASPROGRAMFILEHOST=;
39         
40         ;*';*";*/;quit;run;
41         ODS _ALL_ CLOSE;
NOTE: Writing EXCEL(EGXLSSX) file: /opt/sas/ltv/work/SAS_workBBD800003E04_MYSERVER/#LN11670
42         
2                                                          The SAS System                         Friday, March 10, 2023 08:46:00 AM

43         
44         QUIT; RUN;
45         &lt;/PRE&gt;</description>
      <pubDate>Fri, 10 Mar 2023 11:48:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Columnlabels-in-Excel-via-library/m-p/863406#M341067</guid>
      <dc:creator>Yjn000</dc:creator>
      <dc:date>2023-03-10T11:48:55Z</dc:date>
    </item>
  </channel>
</rss>

