<?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 proc transpose and labels in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-transpose-and-labels/m-p/808001#M318594</link>
    <description>&lt;P&gt;I've noticed that :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1/ Add labels - The label statement creates a WARNING when specifying a label for a variable which is only available in the output dataset e.g. _name_, _label_, col1 and so on, but still add it. The same thing can be observed with the attrib statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2/ Remove labels - When it comes to removing labels, it removes them&amp;nbsp; but creates a warning when it comes to the automatic _name_ and _label_ variable labels. It is the same with the attrib statement using attrib _all_ label=' ' is used.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have any thought on that or any literature which would cover this topic?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is some code to play around the different scenaries.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class; 
    length student $4; 
    student='John'; topic1=89; topic2=12; output;
    student='Mary'; topic1=53; topic2=44; output;
run;

proc print data=class noobs;
run;

proc transpose data = class 
               out  = class_t; 
    by student; 
    var topic1 topic2;

    *label student = 'Student Name' 
          topic1  = 'Maths' 
          topic2  = 'Geography'
          _name_  ='XNAME' 
          _label_ ='XLABEL' 
          col1    ='XCOL';

    *attrib student label = 'Student Name'
           topic1  label = 'Maths' 
           topic2  label = 'Geography'
           _name_  label = 'XNAME' 
           _label_ label = 'XLABEL' 
           col1    label = 'XCOL';

    *label _name_ =' '
          _label_=' ';
          
    *attrib _name_  label = '' 
           _label_ label = '';

    attrib _all_ label =' ';
run;

proc print data=class_t noobs;
run;
proc print data=class_t label noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 15 Apr 2022 13:52:55 GMT</pubDate>
    <dc:creator>xxformat_com</dc:creator>
    <dc:date>2022-04-15T13:52:55Z</dc:date>
    <item>
      <title>proc transpose and labels</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-transpose-and-labels/m-p/808001#M318594</link>
      <description>&lt;P&gt;I've noticed that :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1/ Add labels - The label statement creates a WARNING when specifying a label for a variable which is only available in the output dataset e.g. _name_, _label_, col1 and so on, but still add it. The same thing can be observed with the attrib statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2/ Remove labels - When it comes to removing labels, it removes them&amp;nbsp; but creates a warning when it comes to the automatic _name_ and _label_ variable labels. It is the same with the attrib statement using attrib _all_ label=' ' is used.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have any thought on that or any literature which would cover this topic?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is some code to play around the different scenaries.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class; 
    length student $4; 
    student='John'; topic1=89; topic2=12; output;
    student='Mary'; topic1=53; topic2=44; output;
run;

proc print data=class noobs;
run;

proc transpose data = class 
               out  = class_t; 
    by student; 
    var topic1 topic2;

    *label student = 'Student Name' 
          topic1  = 'Maths' 
          topic2  = 'Geography'
          _name_  ='XNAME' 
          _label_ ='XLABEL' 
          col1    ='XCOL';

    *attrib student label = 'Student Name'
           topic1  label = 'Maths' 
           topic2  label = 'Geography'
           _name_  label = 'XNAME' 
           _label_ label = 'XLABEL' 
           col1    label = 'XCOL';

    *label _name_ =' '
          _label_=' ';
          
    *attrib _name_  label = '' 
           _label_ label = '';

    attrib _all_ label =' ';
run;

proc print data=class_t noobs;
run;
proc print data=class_t label noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Apr 2022 13:52:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-transpose-and-labels/m-p/808001#M318594</guid>
      <dc:creator>xxformat_com</dc:creator>
      <dc:date>2022-04-15T13:52:55Z</dc:date>
    </item>
    <item>
      <title>Re: proc transpose and labels</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-transpose-and-labels/m-p/808015#M318604</link>
      <description>&lt;P&gt;There are two basic approaches to dealing with assigning labels to variables other than _name_&amp;nbsp; variable.&lt;/P&gt;
&lt;P&gt;The Proc Transpose option LABEL sets the value of the label for the _name_ variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are using the ID option you can include another variable that holds the intended label for the transposed variable names created by use of ID.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or use Proc DATASETS to add labels to the created transposed data after the set is created.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Apr 2022 14:49:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-transpose-and-labels/m-p/808015#M318604</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-04-15T14:49:39Z</dc:date>
    </item>
  </channel>
</rss>

