<?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: How to save matching variable name after merging data sets? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-save-matching-variable-name-after-merging-data-sets/m-p/478832#M286426</link>
    <description>&lt;P&gt;Rename the variable in one of the data sets. You can do that in the merge, you don't say how you merge but it can be done in either a SQL or data step merge.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;merge data1 data2(rename=(street=d2_street));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/181583"&gt;@Ramsha&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt;I have merged two data sets by a variable called "ID." However, both data sets that I merged contained the variable "Street." After I merged the two data sets, only the first dataset's Street variable column remained. How can I keep both of the variable Street data in separate columns without overriding one of them? The given data is also from excel files so I cannot easily change the name before importing the data. If there is a code for me to change the name of a given variable, please state. Thank you so much!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 17 Jul 2018 20:52:09 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-07-17T20:52:09Z</dc:date>
    <item>
      <title>How to save matching variable name after merging data sets?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-save-matching-variable-name-after-merging-data-sets/m-p/478824#M286424</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I have merged two data sets by a variable called "ID." However, both data sets that I merged contained the variable "Street." After I merged the two data sets, only the first dataset's Street variable column remained. How can I keep both of the variable Street data in separate columns without overriding one of them? The given data is also from excel files so I cannot easily change the name before importing the data. If there is a code for me to change the name of a given variable, please state. Thank you so much!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jul 2018 20:45:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-save-matching-variable-name-after-merging-data-sets/m-p/478824#M286424</guid>
      <dc:creator>Ramsha</dc:creator>
      <dc:date>2018-07-17T20:45:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to save matching variable name after merging data sets?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-save-matching-variable-name-after-merging-data-sets/m-p/478829#M286425</link>
      <description>You can rename variables in the merge statement. And there should be an example in the docs of merge statement.&lt;BR /&gt;&lt;BR /&gt;Example (untested)&lt;BR /&gt;merge data_a data_b(rename=(street=street_b));&lt;BR /&gt;by I'd;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 17 Jul 2018 20:50:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-save-matching-variable-name-after-merging-data-sets/m-p/478829#M286425</guid>
      <dc:creator>error_prone</dc:creator>
      <dc:date>2018-07-17T20:50:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to save matching variable name after merging data sets?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-save-matching-variable-name-after-merging-data-sets/m-p/478832#M286426</link>
      <description>&lt;P&gt;Rename the variable in one of the data sets. You can do that in the merge, you don't say how you merge but it can be done in either a SQL or data step merge.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;merge data1 data2(rename=(street=d2_street));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/181583"&gt;@Ramsha&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt;I have merged two data sets by a variable called "ID." However, both data sets that I merged contained the variable "Street." After I merged the two data sets, only the first dataset's Street variable column remained. How can I keep both of the variable Street data in separate columns without overriding one of them? The given data is also from excel files so I cannot easily change the name before importing the data. If there is a code for me to change the name of a given variable, please state. Thank you so much!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jul 2018 20:52:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-save-matching-variable-name-after-merging-data-sets/m-p/478832#M286426</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-07-17T20:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to save matching variable name after merging data sets?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-save-matching-variable-name-after-merging-data-sets/m-p/478833#M286427</link>
      <description>&lt;P&gt;It would help to show the code used to merge the data so we could reference data sets and actual variable names.&lt;/P&gt;
&lt;P&gt;If you used a data step merge then you can use a data set option on one set to change the name:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; merge dataone&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; datatwo (rename=(street = streetwo))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;lt;other code&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jul 2018 20:53:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-save-matching-variable-name-after-merging-data-sets/m-p/478833#M286427</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-07-17T20:53:19Z</dc:date>
    </item>
  </channel>
</rss>

