<?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: How to display variable labels in a sas table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-display-variable-labels-in-a-sas-table/m-p/894022#M353185</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/452474"&gt;@Herrera524&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Where do you want that name change to appear?&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is for a report that I am creating and I need that name to appear in it. Thank you very much for your support&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm going to use what you shared with me.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Every reporting procedure in SAS allows you to use labels instead of the variable name when it produces a report. In PROC PRINT, the LABEL option is needed. In PROC REPORT, labels are used automatically. In PROC TABULATE, I don't know if labels are used automatically.&lt;/P&gt;</description>
    <pubDate>Wed, 13 Sep 2023 10:12:59 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2023-09-13T10:12:59Z</dc:date>
    <item>
      <title>How to display variable labels in a sas table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-display-variable-labels-in-a-sas-table/m-p/893856#M353108</link>
      <description>&lt;P&gt;Good morning everyone&lt;/P&gt;&lt;P&gt;I wanted to ask you how I can make the name that I am assigning to the etequieta be modified in the output of the table&lt;/P&gt;&lt;PRE&gt;data test;
set test;
label due_in_1_Fixed=due in one your or less fixed rate
;
run;
proc datasets librery=work;
modify test;
label due_in_1_Fixed=due in one your or less fixed rate;
quit;

proc print data=test label;
label due_in_1_Fixed=due in one your or less fixed rate;
var due_in_1_Fixed;
run;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="print.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/87826iFDC2BB8B6E7A5C97/image-size/medium?v=v2&amp;amp;px=400" role="button" title="print.png" alt="print.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 17:24:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-display-variable-labels-in-a-sas-table/m-p/893856#M353108</guid>
      <dc:creator>Herrera524</dc:creator>
      <dc:date>2023-09-12T17:24:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to display variable labels in a sas table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-display-variable-labels-in-a-sas-table/m-p/893858#M353109</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; 
*Create sample dataset to apply label;
data class;
set sashelp.class;
label Sex="Gender" height="Height (in)"weight="Weight (lbs)";
run;
 
 title 'Show labels';
 proc print data=class(obs=5) label noobs;
 run;
 
  title 'Override labels';
 proc print data=class(obs=5) label noobs;
 label height ="Height (cm)" weight="Weight (kgs)";
 run;
 
 &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Reeza_0-1694540497839.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/87827i36651C7EEB7D7F05/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Reeza_0-1694540497839.png" alt="Reeza_0-1694540497839.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/452474"&gt;@Herrera524&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Good morning everyone&lt;/P&gt;
&lt;P&gt;I wanted to ask you how I can make the name that I am assigning to the etequieta be modified in the output of the table&lt;/P&gt;
&lt;PRE&gt;data test;
set test;
label due_in_1_Fixed=due in one your or less fixed rate
;
run;
proc datasets librery=work;
modify test;
label due_in_1_Fixed=due in one your or less fixed rate;
quit;

proc print data=test label;
label due_in_1_Fixed=due in one your or less fixed rate;
var due_in_1_Fixed;
run;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="print.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/87826iFDC2BB8B6E7A5C97/image-size/medium?v=v2&amp;amp;px=400" role="button" title="print.png" alt="print.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 17:42:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-display-variable-labels-in-a-sas-table/m-p/893858#M353109</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-09-12T17:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to display variable labels in a sas table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-display-variable-labels-in-a-sas-table/m-p/893869#M353112</link>
      <description>&lt;P&gt;I tried to do it according to the example that you shared with me but it does not assign the label to the column name&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 18:50:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-display-variable-labels-in-a-sas-table/m-p/893869#M353112</guid>
      <dc:creator>Herrera524</dc:creator>
      <dc:date>2023-09-12T18:50:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to display variable labels in a sas table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-display-variable-labels-in-a-sas-table/m-p/893872#M353113</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/452474"&gt;@Herrera524&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I tried to do it according to the example that you shared with me but it does not assign the label to the column name&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The code from &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt; works for me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is never sufficient to say code does not work, and provide no other information. Specifically, from now on when code doesn't work, show us the code AND show us what is wrong — either show us the incorrect results, or if there are errors in the log then please show us the entire log for this piece of code&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 18:55:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-display-variable-labels-in-a-sas-table/m-p/893872#M353113</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-09-12T18:55:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to display variable labels in a sas table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-display-variable-labels-in-a-sas-table/m-p/893945#M353141</link>
      <description>&lt;P&gt;Hi&lt;BR /&gt;The code works perfectly for me, but it does not generate the expected result. According to the example, to the Height column I added the label "deu in one year or less fixed rate" which is what I want to appear in the name of the variable , but I still get Height,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Herrera524_0-1694553244025.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/87853iA183D950FD3CB873/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Herrera524_0-1694553244025.png" alt="Herrera524_0-1694553244025.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Herrera524_1-1694553285987.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/87854i6FE1F40C295B9BC6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Herrera524_1-1694553285987.png" alt="Herrera524_1-1694553285987.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;How can I make the label appear instead of the name?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 21:17:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-display-variable-labels-in-a-sas-table/m-p/893945#M353141</guid>
      <dc:creator>Herrera524</dc:creator>
      <dc:date>2023-09-12T21:17:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to display variable labels in a sas table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-display-variable-labels-in-a-sas-table/m-p/893946#M353142</link>
      <description>&lt;P&gt;Changing a label does not change the variable name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, when you do a PROC PRINT with the LABEL option, then the label appears on the output, the variable name does not appear.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 21:20:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-display-variable-labels-in-a-sas-table/m-p/893946#M353142</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-09-12T21:20:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to display variable labels in a sas table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-display-variable-labels-in-a-sas-table/m-p/893948#M353143</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/452474"&gt;@Herrera524&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi&lt;BR /&gt;The code works perfectly for me, but it does not generate the expected result. According to the example, to the Height column I added the label "deu in one year or less fixed rate" &lt;STRONG&gt;which is what I want to appear in the name of the variable&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;STRONG&gt;Where do you want that name change to appear?&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;SAS has variable name limits but you could change it to something less than 32 characters with spaces. I wouldn't recommend doing that because then you have to type it out, but it's doable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;option validvarname = any;

data class;
set sashelp.class;
rename height ='Height in inches'n; *note the n at the end to specify a variable name;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;H4 class="xisDoc-argument"&gt;VALIDVARNAME=ANY&lt;/H4&gt;
&lt;DIV class="xisDoc-argumentDescription"&gt;
&lt;P class="xisDoc-paraSimpleFirst"&gt;allows any characters in DBMS column names to appear as valid characters in SAS variable names. Symbols, such as the equal sign (=) and the asterisk (*), must be contained in a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM class="xisDoc-userSuppliedValue"&gt;'variable-name'&lt;/EM&gt;&lt;CODE class="xisDoc-variableValue"&gt;n&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;construct. You must use ANY whenever you want to read DBMS column names that do not follow the SAS naming conventions.&lt;/P&gt;
&lt;P class="xisDoc-paraSimple"&gt;Up to 32 characters are allowed in a column name.&lt;/P&gt;
&lt;P class="xisDoc-paraSimple"&gt;Any column name that is not unique when it is normalized is made unique by appending a count (0, 1, 2, and so on).&lt;/P&gt;
&lt;P class="xisDoc-paraSimple"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="xisDoc-paraSimple"&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/acreldb/n0vnyuzncldjabn1923ug8svx7uh.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/acreldb/n0vnyuzncldjabn1923ug8svx7uh.htm&lt;/A&gt;&lt;/P&gt;
&lt;P class="xisDoc-paraSimple"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="xisDoc-paraSimple"&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 12 Sep 2023 21:25:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-display-variable-labels-in-a-sas-table/m-p/893948#M353143</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-09-12T21:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to display variable labels in a sas table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-display-variable-labels-in-a-sas-table/m-p/893954#M353148</link>
      <description>&lt;P&gt;The whole point of labels is that it allows you a lot more freedom to provide text to describe a variable than the variable name allows; it is also much more convenient to put this text into the variable label, not the variable name. As &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt; points out, if you want that long text string as the variable name, that's a lot to type each time you want to use this variable (and don't make a spelling error!)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Almost all SAS procedures allow you to use the label in the output. So, there may be rare cases (emphasis on &lt;STRONG&gt;rare&lt;/STRONG&gt;) where labels don't do the job, but really, in virtually every case I can think of, this text ought to go in the label and not the variable name.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 21:43:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-display-variable-labels-in-a-sas-table/m-p/893954#M353148</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-09-12T21:43:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to display variable labels in a sas table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-display-variable-labels-in-a-sas-table/m-p/893967#M353156</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Where do you want that name change to appear?&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is for a report that I am creating and I need that name to appear in it. Thank you very much for your support&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm going to use what you shared with me.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 22:54:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-display-variable-labels-in-a-sas-table/m-p/893967#M353156</guid>
      <dc:creator>Herrera524</dc:creator>
      <dc:date>2023-09-12T22:54:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to display variable labels in a sas table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-display-variable-labels-in-a-sas-table/m-p/894022#M353185</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/452474"&gt;@Herrera524&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Where do you want that name change to appear?&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is for a report that I am creating and I need that name to appear in it. Thank you very much for your support&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm going to use what you shared with me.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Every reporting procedure in SAS allows you to use labels instead of the variable name when it produces a report. In PROC PRINT, the LABEL option is needed. In PROC REPORT, labels are used automatically. In PROC TABULATE, I don't know if labels are used automatically.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2023 10:12:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-display-variable-labels-in-a-sas-table/m-p/894022#M353185</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-09-13T10:12:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to display variable labels in a sas table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-display-variable-labels-in-a-sas-table/m-p/894089#M353198</link>
      <description>&lt;P&gt;If it's for a report, labels should be sufficient. If you can produce a reprex (basic reproducible example) someone can show you how labels can be utilized in that report, for example proc report, tabulate, freq. Labels are definitely the better solution as they don't have the 32 character limit like the variable name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2023 14:30:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-display-variable-labels-in-a-sas-table/m-p/894089#M353198</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-09-13T14:30:14Z</dc:date>
    </item>
  </channel>
</rss>

