<?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: label in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/label/m-p/808473#M318795</link>
    <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Segment="Segment"&amp;nbsp;- what does label like this mean? it is the same variable name.. this means label is not just plainly rename&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is an assignment statement, nothing to do with labelling. You are assigning the value Segment to a variable called Segment. Run this program. It will create a one row table containing a variable called Segment with the assigned value of Segment.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  Segment="Segment";
run; 

proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now add a label to Segment and run this program:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  label Segment = "My Segment";
  Segment="Segment";
run; 

proc print label;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You will see in the PROC PRINT output that instead of the variable name as the column heading SAS now uses the label. That's all a label is - a (longer) description of the actual variable name for use in reporting and analysis.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 19 Apr 2022 03:52:52 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2022-04-19T03:52:52Z</dc:date>
    <item>
      <title>label</title>
      <link>https://communities.sas.com/t5/SAS-Programming/label/m-p/808470#M318794</link>
      <description>&lt;P&gt;what exactly does label do, rename a variable? seems not from the documentation and I dont get it, please see my code included.. my questions is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1.&amp;nbsp;Segment="Segment" - what does label like this mean? it is the same variable name.. this means label is not just plainly rename&lt;/P&gt;
&lt;P&gt;2. label LONG_RUN_pd="Long run default rate";- before this point, I dont have a LONG_RUN_pd variable, is this line creating a new variable LONG_RUN_pd? why then immediately rename it to "Long run default rate"&lt;/P&gt;
&lt;P&gt;also if this is create the new variable LONG_RUN_pd, is it plainly a null column here?&lt;/P&gt;
&lt;P&gt;3. sub_segment="Description" - what is this if not renaming sub_segment to "Description"&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 03:05:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/label/m-p/808470#M318794</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2022-04-19T03:05:06Z</dc:date>
    </item>
    <item>
      <title>Re: label</title>
      <link>https://communities.sas.com/t5/SAS-Programming/label/m-p/808473#M318795</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Segment="Segment"&amp;nbsp;- what does label like this mean? it is the same variable name.. this means label is not just plainly rename&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is an assignment statement, nothing to do with labelling. You are assigning the value Segment to a variable called Segment. Run this program. It will create a one row table containing a variable called Segment with the assigned value of Segment.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  Segment="Segment";
run; 

proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now add a label to Segment and run this program:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  label Segment = "My Segment";
  Segment="Segment";
run; 

proc print label;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You will see in the PROC PRINT output that instead of the variable name as the column heading SAS now uses the label. That's all a label is - a (longer) description of the actual variable name for use in reporting and analysis.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 03:52:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/label/m-p/808473#M318795</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-04-19T03:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: label</title>
      <link>https://communities.sas.com/t5/SAS-Programming/label/m-p/808568#M318835</link>
      <description>&lt;P&gt;Labels are not "renaming" in any way, shape or form.&lt;/P&gt;
&lt;P&gt;Labels for variables (data sets can have labels also) come in two flavors: default and 'as used' (my term). Default is the permanent label assigned to a variable, which may be when created such as in a data set with a Label or Attribute statement, assigned when created by a procedure (look at the label for _name_ from Proc Transpose for example), or when modified in an existing data set with Proc Datasets. If nothing else is assigned the "label" is the variable name. Many procedures will display the label, or some characters of the label, in procedure output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you don't want to use the current label in a specific procedure, maybe it is too long for the display you want or you are using the variable to mean something else temporarily, you can assign a label that is only used for that procedure with a local Label statement or other output option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sometimes people will assign a label that is the same as the variable name to ensure display case. The variable might actually be created as "segment" and the lower case version would be used. So Label segment="Segment" means that the upper case version appears in most output. Or perhaps some organization has rule about code explicitly providing labels for some reason.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Label, just like Format and a number of other statements will create a variable if one by that name does not exist. It will by default be a numeric and have a missing value assigned. If the variable is not used anywhere you are likely to see a note in the log similar to:&lt;/P&gt;
&lt;PRE&gt;NOTE: Variable y is uninitialized.
&lt;/PRE&gt;
&lt;P&gt;Ancient history: Once upon a time very few programming languages allowed variables to have names more than X characters long, where X varied by operating system and language. For example one flavor of BASIC I used had a 2 character limit for variable names: One Upper case letter optionally followed by a digit. SAS provided the LABEL as a method of displaying more information than could be held in the 8 character limit of variable names which did not allow any characters other than Letter, digit or _ character. The label still allows displaying longer than the 32 character limit of variables.&lt;/P&gt;
&lt;P&gt;Labels can help document you data when they are meaningful. There is nothing like inheriting a data set with 50 variables named things like p_22_r_17 with no description (label) and trying to figure what they are supposed to represent.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 14:42:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/label/m-p/808568#M318835</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-04-19T14:42:57Z</dc:date>
    </item>
    <item>
      <title>Re: label</title>
      <link>https://communities.sas.com/t5/SAS-Programming/label/m-p/808675#M318869</link>
      <description>If you're coming from SPSS, SPSS Labels are equivalent to SAS formats. I'm not sure SPSS has the equivalent of a SAS label. A SAS label simply allows you to have a variable with one name, and a displayed value for the variable, the "label" that's cleaner and more explanatory on reports. Also lets you get past the previous SAS limitations of no spaces or symbols in names.</description>
      <pubDate>Tue, 19 Apr 2022 20:11:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/label/m-p/808675#M318869</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-04-19T20:11:50Z</dc:date>
    </item>
    <item>
      <title>Re: label</title>
      <link>https://communities.sas.com/t5/SAS-Programming/label/m-p/808685#M318871</link>
      <description>&lt;P&gt;MAI Business Basic?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 20:52:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/label/m-p/808685#M318871</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-04-19T20:52:30Z</dc:date>
    </item>
    <item>
      <title>Re: label</title>
      <link>https://communities.sas.com/t5/SAS-Programming/label/m-p/808686#M318872</link>
      <description>&lt;P&gt;While a variable &lt;EM&gt;name&lt;/EM&gt;&amp;nbsp;(which you use to address the variable in code) in SAS is limited to 32 characters, a variable&amp;nbsp;&lt;EM&gt;label&lt;/EM&gt;&amp;nbsp;can contain up to 256 characters of free text. The label can be used as column header instead of the name (e.g. when you use PROC PRINT with the LABEL option).&lt;/P&gt;
&lt;P&gt;Labels are described here:&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/n1r8ub0jx34xfsn1ppcjfe0u16pc.htm" target="_blank" rel="noopener"&gt;LABEL Statement&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;BIG&amp;nbsp;&lt;/STRONG&gt;hint: reading the documentation &lt;EM&gt;is&lt;/EM&gt; in fact helpful.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 21:03:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/label/m-p/808686#M318872</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-04-19T21:03:09Z</dc:date>
    </item>
    <item>
      <title>Re: label</title>
      <link>https://communities.sas.com/t5/SAS-Programming/label/m-p/808693#M318876</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;MAI Business Basic?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Don't remember the actual name, BASIC on an IBM-360 circa 1977.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 22:22:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/label/m-p/808693#M318876</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-04-19T22:22:28Z</dc:date>
    </item>
  </channel>
</rss>

