<?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 properly MERGE shell/dummy with data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-properly-MERGE-shell-dummy-with-data/m-p/655644#M196705</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am merging shell/dummy dataset with a dataset.&amp;nbsp; How to output only those with data and keep the shell/dummy labels as well?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully I give you guys enough information&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Current output:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Yellow highlight = from table shell w/data (Need to Keep the table lables)&lt;/P&gt;&lt;P&gt;Red X = from table shell w/ No data (need to remove everything)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HIghlight yellow= from table shell, need to keep. Red &amp;quot;X&amp;quot; = from table shell w/ empty data, DO NOT output;" style="width: 457px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/41601i4F11EDFB15112962/image-dimensions/457x807?v=v2" width="457" height="807" role="button" title="dupes.PNG" alt="HIghlight yellow= from table shell, need to keep. Red &amp;quot;X&amp;quot; = from table shell w/ empty data, DO NOT output;" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;HIghlight yellow= from table shell, need to keep. Red "X" = from table shell w/ empty data, DO NOT output;&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;code:&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data all;
	merge shell		(in=a) 
		  allstats	(in=b) ;&lt;BR /&gt;
	by ord1 ord2 ord3;
	if  a ; /*if b;*/
run;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Jun 2020 21:36:08 GMT</pubDate>
    <dc:creator>HitmonTran</dc:creator>
    <dc:date>2020-06-09T21:36:08Z</dc:date>
    <item>
      <title>How to properly MERGE shell/dummy with data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-properly-MERGE-shell-dummy-with-data/m-p/655644#M196705</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am merging shell/dummy dataset with a dataset.&amp;nbsp; How to output only those with data and keep the shell/dummy labels as well?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully I give you guys enough information&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Current output:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Yellow highlight = from table shell w/data (Need to Keep the table lables)&lt;/P&gt;&lt;P&gt;Red X = from table shell w/ No data (need to remove everything)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HIghlight yellow= from table shell, need to keep. Red &amp;quot;X&amp;quot; = from table shell w/ empty data, DO NOT output;" style="width: 457px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/41601i4F11EDFB15112962/image-dimensions/457x807?v=v2" width="457" height="807" role="button" title="dupes.PNG" alt="HIghlight yellow= from table shell, need to keep. Red &amp;quot;X&amp;quot; = from table shell w/ empty data, DO NOT output;" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;HIghlight yellow= from table shell, need to keep. Red "X" = from table shell w/ empty data, DO NOT output;&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;code:&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data all;
	merge shell		(in=a) 
		  allstats	(in=b) ;&lt;BR /&gt;
	by ord1 ord2 ord3;
	if  a ; /*if b;*/
run;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jun 2020 21:36:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-properly-MERGE-shell-dummy-with-data/m-p/655644#M196705</guid>
      <dc:creator>HitmonTran</dc:creator>
      <dc:date>2020-06-09T21:36:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to properly MERGE shell/dummy with data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-properly-MERGE-shell-dummy-with-data/m-p/655677#M196723</link>
      <description>&lt;P&gt;I might try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data all;
	merge shell		(in=a) 
		  allstats	(in=b) ;
	by ord1 ord2 ord3;
	if first.ord2 or in b;
run;&lt;/PRE&gt;
&lt;P&gt;Each variable on your by statement has some associated temporary variables that indicate whether the current record is the first or last of the current value of the variable. You access them by First.variable or Last.variable, note the dot in there. These temporary variables are 1/0 numeric values and SAS treats 1 as true and 0 as false.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is not clear to&amp;nbsp; me if there are supposed to be two headers at the top or not. You may have to add in a test for the value of: or DESC='Baseline' into the IF.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 00:53:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-properly-MERGE-shell-dummy-with-data/m-p/655677#M196723</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-06-10T00:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to properly MERGE shell/dummy with data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-properly-MERGE-shell-dummy-with-data/m-p/655778#M196731</link>
      <description>1. Making an assumption that if one of the statistic is missing then all values are missing. E.g if n is missing for ord2 then all values are missing for ord2 such as min max, sd etc.&lt;BR /&gt;After doing the merge do the following:&lt;BR /&gt;Proc sql;&lt;BR /&gt;Create table drop_ as &lt;BR /&gt;Select distinct ord2 into  from merged_data where missing(var) and var_name = ‘n’;&lt;BR /&gt;Create table merged_datA as select * from merged_data where ord2 not in (&lt;BR /&gt;Select ord2 from droP_);&lt;BR /&gt;Quit;</description>
      <pubDate>Wed, 10 Jun 2020 02:14:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-properly-MERGE-shell-dummy-with-data/m-p/655778#M196731</guid>
      <dc:creator>smantha</dc:creator>
      <dc:date>2020-06-10T02:14:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to properly MERGE shell/dummy with data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-properly-MERGE-shell-dummy-with-data/m-p/655791#M196738</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if A | VAL ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 03:19:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-properly-MERGE-shell-dummy-with-data/m-p/655791#M196738</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-06-10T03:19:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to properly MERGE shell/dummy with data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-properly-MERGE-shell-dummy-with-data/m-p/655792#M196739</link>
      <description>&lt;P&gt;Even better:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ALL;
  merge SHELL    
        ALLSTARTS (where=(VAL)) ;
  by ORD1 ORD2 ORD3;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 03:21:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-properly-MERGE-shell-dummy-with-data/m-p/655792#M196739</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-06-10T03:21:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to properly MERGE shell/dummy with data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-properly-MERGE-shell-dummy-with-data/m-p/655858#M196746</link>
      <description>Hi Smantha,&lt;BR /&gt;&lt;BR /&gt;it is giving me an error message on "into" statement.&lt;BR /&gt;</description>
      <pubDate>Wed, 10 Jun 2020 04:43:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-properly-MERGE-shell-dummy-with-data/m-p/655858#M196746</guid>
      <dc:creator>HitmonTran</dc:creator>
      <dc:date>2020-06-10T04:43:25Z</dc:date>
    </item>
  </channel>
</rss>

