<?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: Unmerging the files in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Unmerging-the-files/m-p/801298#M33210</link>
    <description>&lt;P&gt;This is&amp;nbsp;&lt;STRONG&gt;not&lt;/STRONG&gt; a merge, but a so-called "stack". For a merge you woukd use the MERGE statement.&lt;/P&gt;
&lt;P&gt;To correctly "unstack" the data you need a variable that has a limited list of values (or just a single value) in one dataset and none of these in the other. A simple example using SASHELP.CLASS:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data
  female
  male
;
set sashelp.class;
if sex = "F"
then output female;
else output male;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 10 Mar 2022 12:29:28 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2022-03-10T12:29:28Z</dc:date>
    <item>
      <title>Unmerging the files</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unmerging-the-files/m-p/801297#M33209</link>
      <description>&lt;P&gt;Hi, I have merged two files and send for processing. I have the files back after additional information but need to unmerge the file now. I used below code to merge the file:&lt;/P&gt;&lt;P&gt;data abc;&lt;BR /&gt;set&lt;BR /&gt;work.abc_external_13jan2022&lt;BR /&gt;work.abc_internal_13jan2022;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let pname = Full_13012022;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc export data=work.abc&lt;BR /&gt;outfile= "\\llocal\shares\Public\\Send files\abc_&amp;amp;pname..csv" dbms=csv replace;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 10 Mar 2022 12:23:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unmerging-the-files/m-p/801297#M33209</guid>
      <dc:creator>Sandeep77</dc:creator>
      <dc:date>2022-03-10T12:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: Unmerging the files</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unmerging-the-files/m-p/801298#M33210</link>
      <description>&lt;P&gt;This is&amp;nbsp;&lt;STRONG&gt;not&lt;/STRONG&gt; a merge, but a so-called "stack". For a merge you woukd use the MERGE statement.&lt;/P&gt;
&lt;P&gt;To correctly "unstack" the data you need a variable that has a limited list of values (or just a single value) in one dataset and none of these in the other. A simple example using SASHELP.CLASS:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data
  female
  male
;
set sashelp.class;
if sex = "F"
then output female;
else output male;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Mar 2022 12:29:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unmerging-the-files/m-p/801298#M33210</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-03-10T12:29:28Z</dc:date>
    </item>
    <item>
      <title>Re: Unmerging the files</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unmerging-the-files/m-p/801355#M33211</link>
      <description>&lt;P&gt;An easy way to get a variable to identify the source of data is the INDSNAME data set option.&lt;/P&gt;
&lt;P&gt;Run this code on your data:&lt;/P&gt;
&lt;PRE&gt;data abc;
   set
      work.abc_external_13jan2022
      work.abc_internal_13jan2022
      indsname=dsn
   ;
   source=dsn;
run;&lt;/PRE&gt;
&lt;P&gt;You will find a variable named Source that has the name of the data set each record comes from.&lt;/P&gt;
&lt;P&gt;The option Indsname creates a temporary variable with the name of the data set. To have it in the output you need to assign it to another variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then it is easy to select the records for other processes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do note that because of the way SAS stores metadata about libraries and library members such as data sets that the name is in all uppercase text.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Mar 2022 15:54:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unmerging-the-files/m-p/801355#M33211</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-03-10T15:54:29Z</dc:date>
    </item>
  </channel>
</rss>

