<?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: Column totally empty after merge in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Column-totally-empty-after-merge/m-p/738501#M230374</link>
    <description>There were no errors in the log but the output of the merged data did not return any values for the columns in the second dataset</description>
    <pubDate>Mon, 03 May 2021 06:54:58 GMT</pubDate>
    <dc:creator>Tbell1</dc:creator>
    <dc:date>2021-05-03T06:54:58Z</dc:date>
    <item>
      <title>Column totally empty after merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Column-totally-empty-after-merge/m-p/738488#M230368</link>
      <description>&lt;P&gt;I am trying to merge two dataset of unequal rows but after merging i got completely empty data. The first dataset has 50 columns and 6320 rows while the second dataset has 5 columns and 220 rows. was trying to merge by a common variable but I got empty data after my merge. This is my code, what am i missing?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data BTS201505WTHR (drop=div:);&lt;BR /&gt;merge BTS201505 WTHRDATA(keep= FlightDate PRCP SNWD SNOW TMAX TMIN);&lt;BR /&gt;by FlightDate ;&lt;BR /&gt;if Origin='ORD';&lt;BR /&gt;run ;&lt;/P&gt;</description>
      <pubDate>Mon, 03 May 2021 05:29:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Column-totally-empty-after-merge/m-p/738488#M230368</guid>
      <dc:creator>Tbell1</dc:creator>
      <dc:date>2021-05-03T05:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: Column totally empty after merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Column-totally-empty-after-merge/m-p/738490#M230370</link>
      <description>You are missing the notes in the log that tell you what happened.&lt;BR /&gt;&lt;BR /&gt;If you want help, post them.</description>
      <pubDate>Mon, 03 May 2021 05:56:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Column-totally-empty-after-merge/m-p/738490#M230370</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-05-03T05:56:40Z</dc:date>
    </item>
    <item>
      <title>Re: Column totally empty after merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Column-totally-empty-after-merge/m-p/738494#M230372</link>
      <description>&lt;P&gt;Looks as if the subsetting-if does not what you expect it to do. Right now you drop any observation not having "ORD" as value of Origin, so checking the values of the variable is the first thing i would do.&lt;/P&gt;</description>
      <pubDate>Mon, 03 May 2021 06:42:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Column-totally-empty-after-merge/m-p/738494#M230372</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-05-03T06:42:04Z</dc:date>
    </item>
    <item>
      <title>Re: Column totally empty after merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Column-totally-empty-after-merge/m-p/738501#M230374</link>
      <description>There were no errors in the log but the output of the merged data did not return any values for the columns in the second dataset</description>
      <pubDate>Mon, 03 May 2021 06:54:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Column-totally-empty-after-merge/m-p/738501#M230374</guid>
      <dc:creator>Tbell1</dc:creator>
      <dc:date>2021-05-03T06:54:58Z</dc:date>
    </item>
    <item>
      <title>Re: Column totally empty after merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Column-totally-empty-after-merge/m-p/738502#M230375</link>
      <description>I removed the if subset but there was no difference, i still got empty columns for the merged dataset</description>
      <pubDate>Mon, 03 May 2021 06:56:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Column-totally-empty-after-merge/m-p/738502#M230375</guid>
      <dc:creator>Tbell1</dc:creator>
      <dc:date>2021-05-03T06:56:15Z</dc:date>
    </item>
    <item>
      <title>Re: Column totally empty after merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Column-totally-empty-after-merge/m-p/738503#M230376</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/380613"&gt;@Tbell1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I removed the if subset but there was no difference, i still got empty columns for the merged dataset&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Have read the log? Are there any unexpected notes? Can you post the log as text, not as screenshot, not as attachment?&lt;/P&gt;</description>
      <pubDate>Mon, 03 May 2021 07:00:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Column-totally-empty-after-merge/m-p/738503#M230376</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-05-03T07:00:15Z</dc:date>
    </item>
    <item>
      <title>Re: Column totally empty after merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Column-totally-empty-after-merge/m-p/738504#M230377</link>
      <description>NOTE: There were 6320 observations read from the data set BTS201505.&lt;BR /&gt;NOTE: There were 220 observations read from the data set WTHRDATA.&lt;BR /&gt;NOTE: The data set BTS201505WTHR has 6245 observations and 42 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 5.99 seconds&lt;BR /&gt;cpu time 2.86 seconds</description>
      <pubDate>Mon, 03 May 2021 07:15:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Column-totally-empty-after-merge/m-p/738504#M230377</guid>
      <dc:creator>Tbell1</dc:creator>
      <dc:date>2021-05-03T07:15:23Z</dc:date>
    </item>
    <item>
      <title>Re: Column totally empty after merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Column-totally-empty-after-merge/m-p/738509#M230380</link>
      <description>&lt;P&gt;In case the columns in your keep list for the 2nd data set are empty then they will overwrite same named columns from your first data set.&lt;/P&gt;
&lt;PRE&gt;WTHRDATA(keep= FlightDate PRCP SNWD SNOW TMAX TMIN);&lt;/PRE&gt;
&lt;P&gt;For cases where there is no match between the DS over FlightDate all columns from the DS not contributing to the obs will be missing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are there any other case where you've got missings in a column that isn't already missing in the source table?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The merge statement is already so long around that it's certainly not a SAS bug so it must be either merge logic or source data.&lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 10:36:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Column-totally-empty-after-merge/m-p/738509#M230380</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-05-04T10:36:13Z</dc:date>
    </item>
    <item>
      <title>Re: Column totally empty after merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Column-totally-empty-after-merge/m-p/738609#M230435</link>
      <description>&lt;P&gt;Check whether or not you are actually getting any matches.&amp;nbsp; Are you expecting a one to one match?&amp;nbsp; A one to many match?&amp;nbsp; Or a many to many match?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the IN= datastep option to create a variable with indicator of whether that dataset contributes to the merge.&lt;/P&gt;
&lt;P&gt;Assign the values to a new variable to keep them in the results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data BTS201505WTHR (drop=div:);
  merge BTS201505(in=in1)
       WTHRDATA(in=in2 keep= FlightDate PRCP SNWD SNOW TMAX TMIN)
  ;
  by FlightDate ;
  length source $32 ;
  if in1 and in2 then source='BOTH';
 else if in1 then source='BTS201505';
 else source='WTHRDATA';
run ;

proc freq ;
  tables source;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do the variables from the second dataset (PRCP SNWD SNOW TMAX TMIN) already exist in the first dataset?&lt;/P&gt;</description>
      <pubDate>Mon, 03 May 2021 14:52:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Column-totally-empty-after-merge/m-p/738609#M230435</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-05-03T14:52:48Z</dc:date>
    </item>
  </channel>
</rss>

