<?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: Assign variable names to a data set based on variable names of another data set in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Assign-variable-names-to-a-data-set-based-on-variable-names-of/m-p/894751#M39782</link>
    <description>&lt;P&gt;If TYPEs match on positions and LENGHTs agr "long enough" in set1, then the SQL union can do the job:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data set1;
  A=1;
  B="xyz";
  C=42;
run;


data set2;
  X=11;
  Y="abc";
  Z=421;
  output;
  X=12;
  Y="abd";
  Z=422;
  output;
run;


proc sql;
create table WANT as
select * from set1(obs=0)
union all
select * from set2
;
quit;

proc print data=WANT;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
    <pubDate>Mon, 18 Sep 2023 08:12:24 GMT</pubDate>
    <dc:creator>yabwon</dc:creator>
    <dc:date>2023-09-18T08:12:24Z</dc:date>
    <item>
      <title>Assign variable names to a data set based on variable names of another data set</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Assign-variable-names-to-a-data-set-based-on-variable-names-of/m-p/894750#M39781</link>
      <description>&lt;P&gt;Hi guys,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;suppose to have a data set1 with column names and another data set2 with other column names. The two data sets have the same number of columns. Is there a way to allow data set2 to take column names of data set1 (position-wise)?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2023 08:05:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Assign-variable-names-to-a-data-set-based-on-variable-names-of/m-p/894750#M39781</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2023-09-18T08:05:57Z</dc:date>
    </item>
    <item>
      <title>Re: Assign variable names to a data set based on variable names of another data set</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Assign-variable-names-to-a-data-set-based-on-variable-names-of/m-p/894751#M39782</link>
      <description>&lt;P&gt;If TYPEs match on positions and LENGHTs agr "long enough" in set1, then the SQL union can do the job:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data set1;
  A=1;
  B="xyz";
  C=42;
run;


data set2;
  X=11;
  Y="abc";
  Z=421;
  output;
  X=12;
  Y="abd";
  Z=422;
  output;
run;


proc sql;
create table WANT as
select * from set1(obs=0)
union all
select * from set2
;
quit;

proc print data=WANT;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2023 08:12:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Assign-variable-names-to-a-data-set-based-on-variable-names-of/m-p/894751#M39782</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-09-18T08:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: Assign variable names to a data set based on variable names of another data set</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Assign-variable-names-to-a-data-set-based-on-variable-names-of/m-p/894757#M39783</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/134532"&gt;@NewUsrStat&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi guys,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;suppose to have a data set1 with column names and another data set2 with other column names. The two data sets have the same number of columns. Is there a way to allow data set2 to take column names of data set1 (position-wise)?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Can't you fix the creation of dataste2, so it uses the correct names instead of the wrong ones?&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2023 10:04:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Assign-variable-names-to-a-data-set-based-on-variable-names-of/m-p/894757#M39783</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2023-09-18T10:04:24Z</dc:date>
    </item>
    <item>
      <title>Re: Assign variable names to a data set based on variable names of another data set</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Assign-variable-names-to-a-data-set-based-on-variable-names-of/m-p/894771#M39784</link>
      <description>Thank you very much! It works perfectly&lt;BR /&gt;</description>
      <pubDate>Mon, 18 Sep 2023 12:13:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Assign-variable-names-to-a-data-set-based-on-variable-names-of/m-p/894771#M39784</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2023-09-18T12:13:40Z</dc:date>
    </item>
  </channel>
</rss>

