<?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 Why are there two ways of renaming variables? And which method is the preferred method? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Why-are-there-two-ways-of-renaming-variables-And-which-method-is/m-p/838334#M331455</link>
    <description>&lt;P&gt;In the textbook (Elliot - SAS essentials pg), it showed us two ways of renaming variable(s).&lt;/P&gt;&lt;P&gt;Method 1, with parenthesis&lt;/P&gt;&lt;PRE&gt;DATA NEW; SET TRANSPOSED (RENAME (INFO1=T1 INFO2=T2 INFO3=T3 INFO4=T4 INFO5=GENDER));
RUN;&lt;/PRE&gt;&lt;P&gt;Method 2, without parenthesis&lt;/P&gt;&lt;PRE&gt;DATA NEW; SET TRANSPOSED;
RENAME INFO1=T1 INFO2=T2 INFO3=T3 INFO4=T4 INFO5=GENDER;&lt;BR /&gt;RUN;&lt;/PRE&gt;&lt;P&gt;Is there any reason to used one method over the other one? or they are both equal in the eyes of SAS programming?&lt;/P&gt;</description>
    <pubDate>Thu, 13 Oct 2022 05:03:58 GMT</pubDate>
    <dc:creator>Nietzsche</dc:creator>
    <dc:date>2022-10-13T05:03:58Z</dc:date>
    <item>
      <title>Why are there two ways of renaming variables? And which method is the preferred method?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-are-there-two-ways-of-renaming-variables-And-which-method-is/m-p/838334#M331455</link>
      <description>&lt;P&gt;In the textbook (Elliot - SAS essentials pg), it showed us two ways of renaming variable(s).&lt;/P&gt;&lt;P&gt;Method 1, with parenthesis&lt;/P&gt;&lt;PRE&gt;DATA NEW; SET TRANSPOSED (RENAME (INFO1=T1 INFO2=T2 INFO3=T3 INFO4=T4 INFO5=GENDER));
RUN;&lt;/PRE&gt;&lt;P&gt;Method 2, without parenthesis&lt;/P&gt;&lt;PRE&gt;DATA NEW; SET TRANSPOSED;
RENAME INFO1=T1 INFO2=T2 INFO3=T3 INFO4=T4 INFO5=GENDER;&lt;BR /&gt;RUN;&lt;/PRE&gt;&lt;P&gt;Is there any reason to used one method over the other one? or they are both equal in the eyes of SAS programming?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 05:03:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-are-there-two-ways-of-renaming-variables-And-which-method-is/m-p/838334#M331455</guid>
      <dc:creator>Nietzsche</dc:creator>
      <dc:date>2022-10-13T05:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: Why are there two ways of renaming variables? And which method is the preferred method?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-are-there-two-ways-of-renaming-variables-And-which-method-is/m-p/838335#M331456</link>
      <description>&lt;P&gt;The dataset option allows renaming for each individual dataset (SET and MERGE allow multiple datasets) before the PDV is built, while the RENAME statement works in the context of the PDV.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 05:22:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-are-there-two-ways-of-renaming-variables-And-which-method-is/m-p/838335#M331456</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-10-13T05:22:08Z</dc:date>
    </item>
    <item>
      <title>Re: Why are there two ways of renaming variables? And which method is the preferred method?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-are-there-two-ways-of-renaming-variables-And-which-method-is/m-p/838342#M331458</link>
      <description>&lt;P&gt;For your method 1 the correct syntax needs to include an equal sign.&lt;/P&gt;
&lt;PRE&gt;DATA NEW; SET TRANSPOSED (RENAME=(INFO1=T1 INFO2=T2 INFO3=T3 INFO4=T4 INFO5=GENDER));
RUN;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1665642409703.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76125iE34FE12DC19C060B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1665642409703.png" alt="Patrick_0-1665642409703.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 06:26:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-are-there-two-ways-of-renaming-variables-And-which-method-is/m-p/838342#M331458</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-10-13T06:26:54Z</dc:date>
    </item>
    <item>
      <title>Re: Why are there two ways of renaming variables? And which method is the preferred method?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-are-there-two-ways-of-renaming-variables-And-which-method-is/m-p/838353#M331466</link>
      <description>&lt;P&gt;note to myself:&lt;/P&gt;&lt;P&gt;PDV = Program Data Vector&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 08:55:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-are-there-two-ways-of-renaming-variables-And-which-method-is/m-p/838353#M331466</guid>
      <dc:creator>Nietzsche</dc:creator>
      <dc:date>2022-10-13T08:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: Why are there two ways of renaming variables? And which method is the preferred method?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-are-there-two-ways-of-renaming-variables-And-which-method-is/m-p/838354#M331468</link>
      <description>&lt;P&gt;Oh yes, PDV is such a common acronym among SASians that we often overlook it may be confusing to beginners.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 08:59:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-are-there-two-ways-of-renaming-variables-And-which-method-is/m-p/838354#M331468</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-10-13T08:59:54Z</dc:date>
    </item>
    <item>
      <title>Re: Why are there two ways of renaming variables? And which method is the preferred method?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-are-there-two-ways-of-renaming-variables-And-which-method-is/m-p/838399#M331488</link>
      <description>&lt;P&gt;Those are not really equivalent.&lt;/P&gt;
&lt;P&gt;The equivalent code using the RENAME= dataset option would be with the option on the output dataset.&lt;/P&gt;
&lt;P&gt;The way you have it the names of the variables during the execution of the data step will be the NEW names.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the RENAME= option in other code than data steps, such as PROC steps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In general you should only use the RENAME= dataset option when you NEED to use it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example where you need to use the RENAME= dataset option. There was a recent question where someone needed to match FID in one dataset to FAMID in another dataset.&amp;nbsp; You could use the RENAME= dataset option on one of the input datasets to make that happen.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  merge dads(rename=(fid=famid)) kids;
  by famid;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Oct 2022 13:29:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-are-there-two-ways-of-renaming-variables-And-which-method-is/m-p/838399#M331488</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-10-13T13:29:19Z</dc:date>
    </item>
  </channel>
</rss>

