<?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: Is it possible to give one variable multiple names in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Is-it-possible-to-give-one-variable-multiple-names/m-p/744718#M29326</link>
    <description>&lt;P&gt;No.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What are you actually trying to do?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can change the label in the step that is using the dataset.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data=sashelp.class;
  var age;
  label age = 'Age of student';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 31 May 2021 02:46:32 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2021-05-31T02:46:32Z</dc:date>
    <item>
      <title>Is it possible to give one variable multiple names</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Is-it-possible-to-give-one-variable-multiple-names/m-p/744714#M29324</link>
      <description>&lt;P&gt;Is it possible to give one variable multiple names using format statement or label statement?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a variable called&amp;nbsp; "clinical" and I want to describe it in 3 different descriptions "visit", "lab" and patient". I am not sure if I will be bale to do it using label statement .&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 May 2021 01:37:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Is-it-possible-to-give-one-variable-multiple-names/m-p/744714#M29324</guid>
      <dc:creator>hjjijkkl</dc:creator>
      <dc:date>2021-05-31T01:37:31Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to give one variable multiple names</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Is-it-possible-to-give-one-variable-multiple-names/m-p/744715#M29325</link>
      <description>&lt;P&gt;You can give a variable only one variable name&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But you could leverage the syntax of the old-style array declaration, as in:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  set sashelp.class ;
  array a age;
  _i_=1;
  if sex='F' then a=-1*a;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The above effectively aliases the array name a with the variable age.&amp;nbsp; The resulting dataset will have will not have a variable named &lt;EM&gt;&lt;STRONG&gt;a&lt;/STRONG&gt;&lt;/EM&gt;, only the variable &lt;EM&gt;&lt;STRONG&gt;age&lt;/STRONG&gt;&lt;/EM&gt;, with values modified as per the code above.&amp;nbsp; Since this type of SAS array uses the automatic variable _i_ (unsaved in the resulting dataset) as its index, you have to set _i_=1, so that a reference to &lt;EM&gt;&lt;STRONG&gt;a&lt;/STRONG&gt;&lt;/EM&gt; accesses the first (and only) member of the array, namely the variable age.&amp;nbsp; You could make several aliases this way to the same variable, but you only have to set _i_=1 once.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your case, I presume you could use:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  array visit clinical;
  array lab clinical;
  array patient clinical;
  _i_=1;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Every reference to the names &lt;EM&gt;&lt;STRONG&gt;visit&lt;/STRONG&gt;&lt;/EM&gt;, &lt;EM&gt;&lt;STRONG&gt;lab&lt;/STRONG&gt;&lt;/EM&gt;, or &lt;EM&gt;&lt;STRONG&gt;patient&lt;/STRONG&gt;&lt;/EM&gt; will use the variable &lt;EM&gt;&lt;STRONG&gt;clinical&lt;/STRONG&gt;&lt;/EM&gt;.&amp;nbsp; &amp;nbsp;I'm not sure I recommend this idea, but it can be done.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One major caveat.&amp;nbsp; If you were to use this technique, do NOT use old style array declarations for any array with multiple elements.&amp;nbsp; For such cases, use the new style, as in:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  array ret{5} ret1-ret5;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And of course, do not use the variable _I_ for any other purpose.&lt;/P&gt;</description>
      <pubDate>Mon, 31 May 2021 02:23:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Is-it-possible-to-give-one-variable-multiple-names/m-p/744715#M29325</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2021-05-31T02:23:57Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to give one variable multiple names</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Is-it-possible-to-give-one-variable-multiple-names/m-p/744718#M29326</link>
      <description>&lt;P&gt;No.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What are you actually trying to do?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can change the label in the step that is using the dataset.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data=sashelp.class;
  var age;
  label age = 'Age of student';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 31 May 2021 02:46:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Is-it-possible-to-give-one-variable-multiple-names/m-p/744718#M29326</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-05-31T02:46:32Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to give one variable multiple names</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Is-it-possible-to-give-one-variable-multiple-names/m-p/744729#M29327</link>
      <description>&lt;P&gt;In the physical structure of a dataset, there is one name and one label for each variable, so in the context of stored data, the answer is no.&lt;/P&gt;
&lt;P&gt;In the context of data step code, trickery is possible, but it only exists during that particular step, and the confusion caused by such trickery is a&amp;nbsp;&lt;STRONG&gt;VERY BAD THING.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 31 May 2021 05:10:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Is-it-possible-to-give-one-variable-multiple-names/m-p/744729#M29327</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-05-31T05:10:48Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to give one variable multiple names</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Is-it-possible-to-give-one-variable-multiple-names/m-p/744823#M29331</link>
      <description>&lt;P&gt;Depending on HOW you are using the variable you can change the LABEL in different procedures or possibly even different uses within a procedure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;An example of using a single variable multiple times in Proc Tabulate and changing the LABEL used for each occurrence.&lt;/P&gt;
&lt;PRE&gt;proc tabulate data=sashelp.class;
   class sex age;
   var height weight;
   tables sex='Child sex'*n
          sex='Sex'*height*mean
          sex='Other label'*weight*max,
          age
   ;
run;&lt;/PRE&gt;
&lt;P&gt;But details as to the actual use would be needed to see what other approaches might be useful.&lt;/P&gt;</description>
      <pubDate>Mon, 31 May 2021 19:47:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Is-it-possible-to-give-one-variable-multiple-names/m-p/744823#M29331</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-05-31T19:47:14Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to give one variable multiple names</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Is-it-possible-to-give-one-variable-multiple-names/m-p/744826#M29333</link>
      <description>&lt;P&gt;Hello &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/222563"&gt;@hjjijkkl&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is such a bad idea, I wonder why you want to do this. You can assign the exact same values to many variables, but even that seems pointless in most cases. And that's not what you asked. You need to re-think this whole thing. Please state your goal behind this question (goal being where you intend to go, not how you want to get there, which is to give variable multiple names).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, I find this such a bad idea, multiple names for one variable, that I repeat the words of &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt; above:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;In the physical structure of a dataset, there is one name and one label for each variable, so in the context of stored data, the answer is no. In the context of data step code, trickery is possible, but it only exists during that particular step, and the confusion caused by such trickery is a&amp;nbsp;&lt;STRONG&gt;VERY BAD THING.&lt;/STRONG&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 May 2021 20:26:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Is-it-possible-to-give-one-variable-multiple-names/m-p/744826#M29333</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-05-31T20:26:39Z</dc:date>
    </item>
  </channel>
</rss>

