<?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 proc sql left join rename variables from second table in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/proc-sql-left-join-rename-variables-from-second-table/m-p/603934#M17008</link>
    <description>&lt;P&gt;Hello!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is my code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;create table open_adms8 as &lt;BR /&gt;select a.*, b.IMPAIRMENT_OTHER as SELF_CARE, b.IMPAIRMENT_TYPE_ID as IMPAIRMENT_ID_1, b.SEVERITY_LEVEL_ID as&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SEVERITY_LEVEL_1&lt;BR /&gt;from open_adms7 a left join self_care b on a.ADMISSION_ID = b.ADMISSION_ID;&lt;BR /&gt;quit; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm finding that the variables from table B don't adopt the name I've tried assigning to them, they just remain as the original variable names (IMPAIRMENT_OTHER, IMPAIRMENT_TYPE_ID, SEVERITY_LEVEL_ID). Any reason why? I know this would work if I was just selecting and renaming from table A. What can I do?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 13 Nov 2019 18:53:40 GMT</pubDate>
    <dc:creator>accintron</dc:creator>
    <dc:date>2019-11-13T18:53:40Z</dc:date>
    <item>
      <title>proc sql left join rename variables from second table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/proc-sql-left-join-rename-variables-from-second-table/m-p/603934#M17008</link>
      <description>&lt;P&gt;Hello!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is my code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;create table open_adms8 as &lt;BR /&gt;select a.*, b.IMPAIRMENT_OTHER as SELF_CARE, b.IMPAIRMENT_TYPE_ID as IMPAIRMENT_ID_1, b.SEVERITY_LEVEL_ID as&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SEVERITY_LEVEL_1&lt;BR /&gt;from open_adms7 a left join self_care b on a.ADMISSION_ID = b.ADMISSION_ID;&lt;BR /&gt;quit; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm finding that the variables from table B don't adopt the name I've tried assigning to them, they just remain as the original variable names (IMPAIRMENT_OTHER, IMPAIRMENT_TYPE_ID, SEVERITY_LEVEL_ID). Any reason why? I know this would work if I was just selecting and renaming from table A. What can I do?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2019 18:53:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/proc-sql-left-join-rename-variables-from-second-table/m-p/603934#M17008</guid>
      <dc:creator>accintron</dc:creator>
      <dc:date>2019-11-13T18:53:40Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql left join rename variables from second table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/proc-sql-left-join-rename-variables-from-second-table/m-p/603944#M17009</link>
      <description>&lt;P&gt;I ran your code using some tables with overlapping data in sashelp library.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It appears to have run correctly as follows:&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table open_adms8 as&lt;BR /&gt;select a.*,&lt;BR /&gt;b.REGION as SELF_CARE,&lt;BR /&gt;b.PRODUCT as IMPAIRMENT_ID_1,&lt;BR /&gt;b.STORES as SEVERITY_LEVEL_1&lt;BR /&gt;from sashelp.cars a left join sashelp.shoes b on a.ORIGIN = b.REGION;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you provide your log?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2019 19:28:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/proc-sql-left-join-rename-variables-from-second-table/m-p/603944#M17009</guid>
      <dc:creator>edo333</dc:creator>
      <dc:date>2019-11-13T19:28:58Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql left join rename variables from second table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/proc-sql-left-join-rename-variables-from-second-table/m-p/603946#M17010</link>
      <description>&lt;P&gt;Yes, I also had no issue in running the code, but it doesnt successfully change the variable names. The log is as follows:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;864 proc sql;&lt;BR /&gt;865 create table open_adms8 as&lt;BR /&gt;866 select a.*, b.IMPAIRMENT_OTHER as self_care, b.IMPAIRMENT_TYPE_ID as IMPAIRMENT_ID_1,&lt;BR /&gt;866 ! b.SEVERITY_LEVEL_ID as SEVERITY_LEVEL_1&lt;BR /&gt;867 from open_adms7 a left join self_care b on a.ADMISSION_ID = b.ADMISSION_ID;&lt;BR /&gt;NOTE: Compressing data set WORK.OPEN_ADMS8 decreased size by 97.73 percent.&lt;BR /&gt;Compressed is 2 pages; un-compressed would require 88 pages.&lt;BR /&gt;NOTE: Table WORK.OPEN_ADMS8 created, with 349 rows and 87 columns.&lt;/P&gt;
&lt;P&gt;868 quit;&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 0.05 seconds&lt;BR /&gt;cpu time 0.04 seconds&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2019 19:38:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/proc-sql-left-join-rename-variables-from-second-table/m-p/603946#M17010</guid>
      <dc:creator>accintron</dc:creator>
      <dc:date>2019-11-13T19:38:11Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql left join rename variables from second table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/proc-sql-left-join-rename-variables-from-second-table/m-p/603954#M17011</link>
      <description>&lt;P&gt;Run a proc contents on open_adms8 immediately after this step, and show us the output.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2019 19:57:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/proc-sql-left-join-rename-variables-from-second-table/m-p/603954#M17011</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-11-13T19:57:09Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql left join rename variables from second table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/proc-sql-left-join-rename-variables-from-second-table/m-p/603974#M17012</link>
      <description>&lt;P&gt;If your A data set has a variable named IMPAIRMENT_OTHER&amp;nbsp;then that variable will be there and I would expect another variable named self_care to be further the to right in a table view.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Exactly how are you determining that the variables aren't getting renamed?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that in this example the A dataset version of age is in the output as well as the renamed age from set B&lt;/P&gt;
&lt;PRE&gt;proc sql;
   create table work.demo as
   select a.*, b.age as bage
   from sashelp.class as a
        left join
        sashelp.class as b
        on a.name=b.name
   ;
run;&lt;/PRE&gt;
&lt;P&gt;Perhaps you just didn't scroll over to the right of the data set far enough.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2019 20:58:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/proc-sql-left-join-rename-variables-from-second-table/m-p/603974#M17012</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-11-13T20:58:19Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql left join rename variables from second table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/proc-sql-left-join-rename-variables-from-second-table/m-p/603995#M17014</link>
      <description>&lt;P&gt;You might be looking at the variable labels which remain the original ones. To change them, try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;create table open_adms8 as&lt;BR /&gt;select a.*, b.IMPAIRMENT_OTHER as SELF_CARE "Self Care",&lt;/P&gt;
&lt;P&gt;b.IMPAIRMENT_TYPE_ID as IMPAIRMENT_ID_1 "Impairment Id",&lt;/P&gt;
&lt;P&gt;b.SEVERITY_LEVEL_ID as SEVERITY_LEVEL_1 "Severity Level"&lt;BR /&gt;from open_adms7 a left join self_care b on a.ADMISSION_ID = b.ADMISSION_ID;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2019 23:11:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/proc-sql-left-join-rename-variables-from-second-table/m-p/603995#M17014</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-11-13T23:11:15Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql left join rename variables from second table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/proc-sql-left-join-rename-variables-from-second-table/m-p/605048#M17168</link>
      <description>&lt;P&gt;Yep, I was looking at labels. By tweaking my code with your suggestions it worked out. Thank you so much!&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2019 15:22:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/proc-sql-left-join-rename-variables-from-second-table/m-p/605048#M17168</guid>
      <dc:creator>accintron</dc:creator>
      <dc:date>2019-11-18T15:22:45Z</dc:date>
    </item>
  </channel>
</rss>

