<?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 how to combined two dataset without merging id in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-combined-two-dataset-without-merging-id/m-p/924881#M364031</link>
    <description>&lt;P&gt;hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have two dataset and I want to&amp;nbsp;horizontal stacking them. the two dataset have same variable name but different rows. I would like to keep all cols and can add a_ , b_ in front of original col names. how can I achieve this?&lt;/P&gt;
&lt;PRE&gt;data df_a;
infile datalines dsd truncover;
input id sex $ stop;
datalines;
1,Female,0
1,M,1
1,Male,0
1,F,0
1,,1
;

data df_b;
infile datalines dsd truncover;
input id sex $ stop;
datalines;
2,Female,0
1,M,1
1,Male,0
2,F,0
;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;there is no need to merge by id. just simply put two tables together. the output will look like below:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="stataq_0-1713460802043.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/95662iBA3A1E77DCE358A2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="stataq_0-1713460802043.png" alt="stataq_0-1713460802043.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;any suggestion?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 18 Apr 2024 17:20:48 GMT</pubDate>
    <dc:creator>stataq</dc:creator>
    <dc:date>2024-04-18T17:20:48Z</dc:date>
    <item>
      <title>how to combined two dataset without merging id</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-combined-two-dataset-without-merging-id/m-p/924881#M364031</link>
      <description>&lt;P&gt;hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have two dataset and I want to&amp;nbsp;horizontal stacking them. the two dataset have same variable name but different rows. I would like to keep all cols and can add a_ , b_ in front of original col names. how can I achieve this?&lt;/P&gt;
&lt;PRE&gt;data df_a;
infile datalines dsd truncover;
input id sex $ stop;
datalines;
1,Female,0
1,M,1
1,Male,0
1,F,0
1,,1
;

data df_b;
infile datalines dsd truncover;
input id sex $ stop;
datalines;
2,Female,0
1,M,1
1,Male,0
2,F,0
;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;there is no need to merge by id. just simply put two tables together. the output will look like below:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="stataq_0-1713460802043.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/95662iBA3A1E77DCE358A2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="stataq_0-1713460802043.png" alt="stataq_0-1713460802043.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;any suggestion?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Apr 2024 17:20:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-combined-two-dataset-without-merging-id/m-p/924881#M364031</guid>
      <dc:creator>stataq</dc:creator>
      <dc:date>2024-04-18T17:20:48Z</dc:date>
    </item>
    <item>
      <title>Re: how to combined two dataset without merging id</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-combined-two-dataset-without-merging-id/m-p/924882#M364032</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set df_a df_b;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Apr 2024 17:22:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-combined-two-dataset-without-merging-id/m-p/924882#M364032</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-04-18T17:22:16Z</dc:date>
    </item>
    <item>
      <title>Re: how to combined two dataset without merging id</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-combined-two-dataset-without-merging-id/m-p/924884#M364033</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc datasets library=work NoList NoDetails memtype=data;
 delete want; run;
QUIT;
proc append base=want data=df_a; run;
proc append base=want data=df_b; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Thu, 18 Apr 2024 17:26:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-combined-two-dataset-without-merging-id/m-p/924884#M364033</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2024-04-18T17:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: how to combined two dataset without merging id</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-combined-two-dataset-without-merging-id/m-p/924887#M364035</link>
      <description>&lt;P&gt;simple set statement will create vertical staking instead.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Apr 2024 17:31:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-combined-two-dataset-without-merging-id/m-p/924887#M364035</guid>
      <dc:creator>stataq</dc:creator>
      <dc:date>2024-04-18T17:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: how to combined two dataset without merging id</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-combined-two-dataset-without-merging-id/m-p/924889#M364036</link>
      <description>&lt;P&gt;Oh sorry. You want horizontal stacking (instead of vertical).&amp;nbsp;&lt;BR /&gt;PROC APPEND cannot do this.&lt;BR /&gt;Let me re-write.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Thu, 18 Apr 2024 17:33:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-combined-two-dataset-without-merging-id/m-p/924889#M364036</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2024-04-18T17:33:46Z</dc:date>
    </item>
    <item>
      <title>Re: how to combined two dataset without merging id</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-combined-two-dataset-without-merging-id/m-p/924890#M364037</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* below df_c will contain only 4 observations --&amp;gt; wrong */
data df_c;
 set df_a(rename=(id=a_id sex=a_sex stop=a_stop));
 set df_b(rename=(id=b_id sex=b_sex stop=b_stop));
run;

/* below df_c will contain      5 observations --&amp;gt; okay  */
options MERGENOBY=WARN;
data df_c;
 merge df_a(rename=(id=a_id sex=a_sex stop=a_stop))
       df_b(rename=(id=b_id sex=b_sex stop=b_stop));
run;
/* end of program */&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Thu, 18 Apr 2024 17:41:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-combined-two-dataset-without-merging-id/m-p/924890#M364037</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2024-04-18T17:41:47Z</dc:date>
    </item>
  </channel>
</rss>

