<?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 - same columns in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-same-columns/m-p/634539#M188334</link>
    <description>&lt;P&gt;It will help to provide a clear example of what your are attempting to do. As in show a sample of the two data sets, maybe 5 variables each where you have the "same columns" and what the result is expected to be when things are done.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And perhaps SQL isn't what you need. The data step allows uses of variable name lists that may make things easier. But without seeing a pretty concrete example of what you need it is hard to tell.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best is if the data could be provided in the form of a data step so we have something to manipulate. Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the &amp;lt;&amp;gt; icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;</description>
    <pubDate>Tue, 24 Mar 2020 19:14:05 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-03-24T19:14:05Z</dc:date>
    <item>
      <title>Proc Sql - same columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-same-columns/m-p/634523#M188324</link>
      <description>&lt;P&gt;Good Afternoon,&lt;/P&gt;
&lt;P&gt;I need to use a proc sql with two DB that has the same columns (name), so I think I have to rename the columns of one of the two tables (I need to Keep all the columns of the two DB), but I have a big number of columns and it's not so easy to list all. I find some soluction with "Index" function but &lt;EM&gt;I'm not able to use it. Please can you help me ?&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Tnks a lot. &lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Tecla &lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2020 18:02:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-same-columns/m-p/634523#M188324</guid>
      <dc:creator>Tecla1</dc:creator>
      <dc:date>2020-03-24T18:02:28Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sql - same columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-same-columns/m-p/634526#M188326</link>
      <description>&lt;P&gt;If you have the same column names what are you trying to do overall?&lt;/P&gt;
&lt;P&gt;Sometimes it makes more sense to append and transpose?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can add a prefix/suffix to all the variables as well, which is another option. If your table name was SAMPLE in the WORK library this would add the NEW_ prefix to each variable name. Note that it is case sensitive for the comparisons.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Let prefix = new_;

proc sql noprint;
select catx("=", name, catx("_", "&amp;amp;prefix.", name))
into :rename_list
separated by " "
from sashelp.vcolumn
where libname='WORK'
and memname='SAMPLE';
quit;


%put &amp;amp;rename_list;


proc datasets library=work nodetails nolist;
modify sample;
rename &amp;amp;rename_list;
run; quit;

proc print data=sample noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Mar 2020 18:11:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-same-columns/m-p/634526#M188326</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-03-24T18:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sql - same columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-same-columns/m-p/634539#M188334</link>
      <description>&lt;P&gt;It will help to provide a clear example of what your are attempting to do. As in show a sample of the two data sets, maybe 5 variables each where you have the "same columns" and what the result is expected to be when things are done.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And perhaps SQL isn't what you need. The data step allows uses of variable name lists that may make things easier. But without seeing a pretty concrete example of what you need it is hard to tell.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best is if the data could be provided in the form of a data step so we have something to manipulate. Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the &amp;lt;&amp;gt; icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2020 19:14:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-same-columns/m-p/634539#M188334</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-03-24T19:14:05Z</dc:date>
    </item>
  </channel>
</rss>

