<?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: Why Can I Use _CHARACTER_ as a Variable Name? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Why-Can-I-Use-CHARACTER-as-a-Variable-Name/m-p/14879#M1907</link>
    <description>I cannot answer the question but though this was interesting.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
2326  data _null_;&lt;BR /&gt;
2327     _char_ = 1233;&lt;BR /&gt;
ERROR: Cannot use _char_ as a variable name.&lt;BR /&gt;
2328     run;&lt;BR /&gt;
[/pre]</description>
    <pubDate>Thu, 16 Jun 2011 02:26:33 GMT</pubDate>
    <dc:creator>data_null__</dc:creator>
    <dc:date>2011-06-16T02:26:33Z</dc:date>
    <item>
      <title>Why Can I Use _CHARACTER_ as a Variable Name?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-Can-I-Use-CHARACTER-as-a-Variable-Name/m-p/14878#M1906</link>
      <description>Consider:&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
335  data _null_ ;&lt;BR /&gt;
336  _all_       = 123 ;&lt;BR /&gt;
ERROR: Cannot use _all_ as a variable name.&lt;BR /&gt;
337  _numeric_   = 456 ;&lt;BR /&gt;
ERROR: Cannot use _numeric_ as a variable name.&lt;BR /&gt;
338  _character_ = 789 ;&lt;BR /&gt;
339  run ;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
There's no ERROR after line 338. _CHARACTER_ can be used as a variable name (not that this would be a good idea).&lt;BR /&gt;
&lt;BR /&gt;
Can anyone provide a good reason for the asymmetry with _NUMERIC_ and _ALL_, which trigger errors when used as variable names?&lt;BR /&gt;
&lt;BR /&gt;
SAS 9.2 2M3 on Win XP.&lt;BR /&gt;
&lt;BR /&gt;
Thanks.</description>
      <pubDate>Thu, 16 Jun 2011 02:10:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-Can-I-Use-CHARACTER-as-a-Variable-Name/m-p/14878#M1906</guid>
      <dc:creator>Howles</dc:creator>
      <dc:date>2011-06-16T02:10:20Z</dc:date>
    </item>
    <item>
      <title>Re: Why Can I Use _CHARACTER_ as a Variable Name?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-Can-I-Use-CHARACTER-as-a-Variable-Name/m-p/14879#M1907</link>
      <description>I cannot answer the question but though this was interesting.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
2326  data _null_;&lt;BR /&gt;
2327     _char_ = 1233;&lt;BR /&gt;
ERROR: Cannot use _char_ as a variable name.&lt;BR /&gt;
2328     run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Thu, 16 Jun 2011 02:26:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-Can-I-Use-CHARACTER-as-a-Variable-Name/m-p/14879#M1907</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2011-06-16T02:26:33Z</dc:date>
    </item>
    <item>
      <title>Re: Why Can I Use _CHARACTER_ as a Variable Name?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-Can-I-Use-CHARACTER-as-a-Variable-Name/m-p/14880#M1908</link>
      <description>This is a Special SAS Name List (a type of SAS Variable List) and as such is a reserved word...&lt;BR /&gt;
&lt;BR /&gt;
Check out doco - &lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a000695105.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a000695105.htm&lt;/A&gt; &lt;BR /&gt;
&lt;BR /&gt;
Hope this helps,&lt;BR /&gt;
Michelle</description>
      <pubDate>Thu, 16 Jun 2011 03:14:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-Can-I-Use-CHARACTER-as-a-Variable-Name/m-p/14880#M1908</guid>
      <dc:creator>MichelleHomes</dc:creator>
      <dc:date>2011-06-16T03:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: Why Can I Use _CHARACTER_ as a Variable Name?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-Can-I-Use-CHARACTER-as-a-Variable-Name/m-p/14881#M1909</link>
      <description>To the OP:  if you want to pursue this type of anomaly, you will be best served by going directly to SAS Tech Support and opening a track to ask the question, given what you have uncovered.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Thu, 16 Jun 2011 08:35:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-Can-I-Use-CHARACTER-as-a-Variable-Name/m-p/14881#M1909</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2011-06-16T08:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: Why Can I Use _CHARACTER_ as a Variable Name?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-Can-I-Use-CHARACTER-as-a-Variable-Name/m-p/14882#M1910</link>
      <description>Michelle &lt;BR /&gt;
I can understand why _character_ is reserved, but cannot find reference at the link you provided (nor elsewhere) to _char_&lt;BR /&gt;
&lt;BR /&gt;
Is it just an undocumented alternative to _character_ ?&lt;BR /&gt;
&lt;BR /&gt;
peterC</description>
      <pubDate>Thu, 16 Jun 2011 16:24:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-Can-I-Use-CHARACTER-as-a-Variable-Name/m-p/14882#M1910</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2011-06-16T16:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: Why Can I Use _CHARACTER_ as a Variable Name?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-Can-I-Use-CHARACTER-as-a-Variable-Name/m-p/14883#M1911</link>
      <description>&amp;gt; Is it just an undocumented alternative to _character_&lt;BR /&gt;
&amp;gt; ?&lt;BR /&gt;
&lt;BR /&gt;
I thought _CHAR_was documented but cannot find documentation in relation to SAS Variable List used in data/proc steps.&lt;BR /&gt;
&lt;BR /&gt;
It would appear to me that the "data step team" at SAS thinks _CHAR_ is "something".  &lt;BR /&gt;
&lt;BR /&gt;
Perhaps _CHARACTER_ is allowed to provide some backward compatibility from days of old.&lt;BR /&gt;
&lt;BR /&gt;
Further fiddling with _CHARACTER_ produced interesting context sensitive results.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
2614  options stimer=0 fullstimer=0 missing=.;&lt;BR /&gt;
2615  data test(keep=_character_);&lt;BR /&gt;
2616     if 0 then set sashelp.class;&lt;BR /&gt;
2617     *_char_ = 1233;&lt;BR /&gt;
2618     _character_ = '9';&lt;BR /&gt;
2619     cm = cmiss(of _character_);&lt;BR /&gt;
2620     put _character_;&lt;BR /&gt;
2621     put (_character_)(=);&lt;BR /&gt;
2622     put _character_=;&lt;BR /&gt;
2623     *_numeric_ = '0';&lt;BR /&gt;
2624     array c&lt;LI&gt; _character_;&lt;BR /&gt;
2625     put (c&lt;/LI&gt;&lt;LI&gt;) (=);&lt;BR /&gt;
2626     put _all_;&lt;BR /&gt;
2627     output;&lt;BR /&gt;
2628     stop;&lt;BR /&gt;
2629     run;&lt;BR /&gt;
&lt;BR /&gt;
9&lt;BR /&gt;
Name=  Sex=  _character_=9&lt;BR /&gt;
_character_=9&lt;BR /&gt;
Name=  Sex=  _character_=9&lt;BR /&gt;
Name=  Sex=  Age=. Height=. Weight=. _character_=9 cm=2 _ERROR_=0 _N_=1&lt;BR /&gt;
NOTE: The data set WORK.TEST has 1 observations and 3 variables.&lt;BR /&gt;
&lt;BR /&gt;
2630  data _null_;&lt;BR /&gt;
2631     set test;&lt;BR /&gt;
2632     put _all_;&lt;BR /&gt;
2633     run;&lt;BR /&gt;
&lt;BR /&gt;
Name=  Sex=  _character_=9 _ERROR_=0 _N_=1&lt;BR /&gt;
[/pre]&lt;/LI&gt;</description>
      <pubDate>Thu, 16 Jun 2011 18:58:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-Can-I-Use-CHARACTER-as-a-Variable-Name/m-p/14883#M1911</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2011-06-16T18:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: Why Can I Use _CHARACTER_ as a Variable Name?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-Can-I-Use-CHARACTER-as-a-Variable-Name/m-p/14884#M1912</link>
      <description>Stunning&lt;BR /&gt;
&lt;BR /&gt;
_char_ is not valid as a var name&lt;BR /&gt;
It has the effect of _character_ when used in a keep list&lt;BR /&gt;
I found no corresponding abbreviation of _numeric_</description>
      <pubDate>Thu, 16 Jun 2011 21:15:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-Can-I-Use-CHARACTER-as-a-Variable-Name/m-p/14884#M1912</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2011-06-16T21:15:38Z</dc:date>
    </item>
    <item>
      <title>Re: Why Can I Use _CHARACTER_ as a Variable Name?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-Can-I-Use-CHARACTER-as-a-Variable-Name/m-p/14885#M1913</link>
      <description>We don't seem to have a solid explanation, so I guess it's time to put this in front of Tech Support.&lt;BR /&gt;
&lt;BR /&gt;
The point is that _CHARACTER_ is *not* reserved, at least not in the way _ALL_ is.&lt;BR /&gt;
&lt;BR /&gt;
Also notice that enforcement is more or less limited to the DATA step. Here is a PROC step which is happy to permit use of variable names which are not allowed (or at least discouraged) in the DATA step.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc summary data=sashelp.class(obs=3) nway ;&lt;BR /&gt;
class sex ;&lt;BR /&gt;
output out=badnames(rename = (_freq_ = _n_ _type_=_error_) )&lt;BR /&gt;
       min(age) = _numeric_&lt;BR /&gt;
       max(age) = _character_&lt;BR /&gt;
       mode(age)= _all_&lt;BR /&gt;
       ;&lt;BR /&gt;
run ;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Of course referencing these names will be a problem.&lt;BR /&gt;
&lt;BR /&gt;
Another slightly interesting bit of evidence. When this code&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc print ;&lt;BR /&gt;
var _numeric_ _character_ _char_ _all_ _notmetoo_ ;&lt;BR /&gt;
run ;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
is placed in the enhanced editor, the first four specs in the VAR statement are recognized and thus colored blue rather than black.</description>
      <pubDate>Sat, 18 Jun 2011 23:56:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-Can-I-Use-CHARACTER-as-a-Variable-Name/m-p/14885#M1913</guid>
      <dc:creator>Howles</dc:creator>
      <dc:date>2011-06-18T23:56:12Z</dc:date>
    </item>
  </channel>
</rss>

