<?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: Translating STATA merges to SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Translating-STATA-merges-to-SAS/m-p/509212#M136860</link>
    <description>&lt;P&gt;Example input data and expected results would help. As it is we can not tell what is missing or added.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Provide just enough records and variables in the two sets being merged to show the issues &lt;STRONG&gt;and&lt;/STRONG&gt; what the result should be for the example input data sets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't speak STATA so can't work from the example code but have a pretty fair understanding of how to manipulate data in SAS.&lt;/P&gt;</description>
    <pubDate>Wed, 31 Oct 2018 17:13:56 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-10-31T17:13:56Z</dc:date>
    <item>
      <title>Translating STATA merges to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Translating-STATA-merges-to-SAS/m-p/509196#M136852</link>
      <description>&lt;P&gt;I am translating a colleague's STATA code into SAS and am having trouble replicating the dataset. I think it is a merge issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;His code:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;joinby var1 var2 var3 using dataset name unmatch(both)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA New; 
MERGE A3 (IN=A) D3 (IN=B);
BY var1 var2 var3;
IF A and B then link_status=1;
ELSE IF A and not B then link_status=2;
ELSE link_status=3;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;His code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;merge m:1 var1 using "filename"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data new_; 

merge new (in=A) externaldata (in=B);
by var1;
IF A and B then _merge=1;
ELSE IF A and not B then _merge=2;
ELSE _merge=3;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Oct 2018 16:28:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Translating-STATA-merges-to-SAS/m-p/509196#M136852</guid>
      <dc:creator>martyvd</dc:creator>
      <dc:date>2018-10-31T16:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: Translating STATA merges to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Translating-STATA-merges-to-SAS/m-p/509212#M136860</link>
      <description>&lt;P&gt;Example input data and expected results would help. As it is we can not tell what is missing or added.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Provide just enough records and variables in the two sets being merged to show the issues &lt;STRONG&gt;and&lt;/STRONG&gt; what the result should be for the example input data sets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't speak STATA so can't work from the example code but have a pretty fair understanding of how to manipulate data in SAS.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Oct 2018 17:13:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Translating-STATA-merges-to-SAS/m-p/509212#M136860</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-10-31T17:13:56Z</dc:date>
    </item>
  </channel>
</rss>

