<?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: PROC SQL DB WITH SAME COLUMNS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-DB-WITH-SAME-COLUMNS/m-p/730615#M227530</link>
    <description>&lt;P&gt;AFAIK, no.&lt;/P&gt;
&lt;P&gt;If there is a considerable number of columns, you can create a macro variable containing the code for all columns that you want to do this for:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class1;
set sashelp.class;
run;

data class2;
set sashelp.class;
run;

data _null_;
set sashelp.vcolumn end=done;
where libname = "WORK" and memname = "CLASS2" and upcase(name) ne "NAME";
/* the last condition excludes the key variable on which the join will be made */
length statement $1000;
retain statement;
statement = catx(",",statement,"b."!!name!!" as b_"!!name);
if done then call symputx("statement",statement);
run;

proc sql;
create table want as
  select
    a.*,
    &amp;amp;statement.
  from class1 a, class2 b
  where a.name = b.name
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 01 Apr 2021 08:03:33 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2021-04-01T08:03:33Z</dc:date>
    <item>
      <title>PROC SQL DB WITH SAME COLUMNS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-DB-WITH-SAME-COLUMNS/m-p/730614#M227529</link>
      <description>&lt;P&gt;Good morning to all and many thnks for your kindly help !!!&lt;/P&gt;
&lt;P&gt;I need to do a Proc Sql with two DB that has the same named columns and I need to keep all them, there is a way to rename automatically the second columns DB?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many tnks&lt;/P&gt;
&lt;P&gt;Tecla&lt;/P&gt;</description>
      <pubDate>Thu, 01 Apr 2021 07:40:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-DB-WITH-SAME-COLUMNS/m-p/730614#M227529</guid>
      <dc:creator>Tecla1</dc:creator>
      <dc:date>2021-04-01T07:40:45Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL DB WITH SAME COLUMNS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-DB-WITH-SAME-COLUMNS/m-p/730615#M227530</link>
      <description>&lt;P&gt;AFAIK, no.&lt;/P&gt;
&lt;P&gt;If there is a considerable number of columns, you can create a macro variable containing the code for all columns that you want to do this for:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class1;
set sashelp.class;
run;

data class2;
set sashelp.class;
run;

data _null_;
set sashelp.vcolumn end=done;
where libname = "WORK" and memname = "CLASS2" and upcase(name) ne "NAME";
/* the last condition excludes the key variable on which the join will be made */
length statement $1000;
retain statement;
statement = catx(",",statement,"b."!!name!!" as b_"!!name);
if done then call symputx("statement",statement);
run;

proc sql;
create table want as
  select
    a.*,
    &amp;amp;statement.
  from class1 a, class2 b
  where a.name = b.name
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Apr 2021 08:03:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-DB-WITH-SAME-COLUMNS/m-p/730615#M227530</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-04-01T08:03:33Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL DB WITH SAME COLUMNS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-DB-WITH-SAME-COLUMNS/m-p/730616#M227531</link>
      <description>&lt;P&gt;PS if your purpose is to compare the values in the two tables, consider using&amp;nbsp;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=proc&amp;amp;docsetTarget=n1nwxbchh5hpu1n1h28kmici2awd.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;PROC COMPARE&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Apr 2021 08:05:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-DB-WITH-SAME-COLUMNS/m-p/730616#M227531</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-04-01T08:05:00Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL DB WITH SAME COLUMNS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-DB-WITH-SAME-COLUMNS/m-p/731521#M227869</link>
      <description>Tnks for your kindly replay.&lt;BR /&gt;&lt;BR /&gt;Tecla</description>
      <pubDate>Tue, 06 Apr 2021 07:17:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-DB-WITH-SAME-COLUMNS/m-p/731521#M227869</guid>
      <dc:creator>Tecla1</dc:creator>
      <dc:date>2021-04-06T07:17:54Z</dc:date>
    </item>
  </channel>
</rss>

