<?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: Converting SAS code to SQL in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Converting-SAS-code-to-SQL/m-p/274754#M19061</link>
    <description>&lt;P&gt;Don't forget that Merge treats same named variables in multiple datasets &lt;STRONG&gt;very&lt;/STRONG&gt; differently than a simple join in SQL would.&lt;/P&gt;</description>
    <pubDate>Thu, 02 Jun 2016 18:01:35 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2016-06-02T18:01:35Z</dc:date>
    <item>
      <title>Converting SAS code to SQL</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Converting-SAS-code-to-SQL/m-p/274651#M19055</link>
      <description>&lt;P&gt;Hello Team,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to SAS and looking for converting below code to SQL&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data strat.master;&lt;BR /&gt;merge strat.master1(in=ge) strat.client strat.abc(in=pw);&lt;BR /&gt;by code;&lt;BR /&gt;if ge;&lt;BR /&gt;&lt;SPAN&gt;abc&lt;/SPAN&gt;=pw;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know that Merge by is match merging but not getting meaning of last 3 lines "if ge; abc=pw"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your help is much appreciated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks In advance&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2016 13:14:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Converting-SAS-code-to-SQL/m-p/274651#M19055</guid>
      <dc:creator>yudhishtirb</dc:creator>
      <dc:date>2016-06-02T13:14:54Z</dc:date>
    </item>
    <item>
      <title>Re: Converting SAS code to SQL</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Converting-SAS-code-to-SQL/m-p/274669#M19056</link>
      <description>&lt;P&gt;Note the IN on the merge statement that creates two automatic variables, ge and pw.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The variables are indicators that shownthe source of the record.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If ge -&amp;gt; record is present in indicated dataset. This would be analogous to specifying a right/left join.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Abc=pw -&amp;gt; store an indicator variable that shows if the record was present in the second dataset.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can replicate this functionality using a Case statement in your query.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2016 13:57:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Converting-SAS-code-to-SQL/m-p/274669#M19056</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-06-02T13:57:17Z</dc:date>
    </item>
    <item>
      <title>Re: Converting SAS code to SQL</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Converting-SAS-code-to-SQL/m-p/274742#M19060</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
  CREATE TABLE strat.master AS
  SELECT *
  FROM strat.master sm left join strat.client sc (on sm.code=sc.code) left join strat.abc ab (on sm.code=ab.code);
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Maybe start out with something like this.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2016 17:10:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Converting-SAS-code-to-SQL/m-p/274742#M19060</guid>
      <dc:creator>JediApprentice</dc:creator>
      <dc:date>2016-06-02T17:10:20Z</dc:date>
    </item>
    <item>
      <title>Re: Converting SAS code to SQL</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Converting-SAS-code-to-SQL/m-p/274754#M19061</link>
      <description>&lt;P&gt;Don't forget that Merge treats same named variables in multiple datasets &lt;STRONG&gt;very&lt;/STRONG&gt; differently than a simple join in SQL would.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2016 18:01:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Converting-SAS-code-to-SQL/m-p/274754#M19061</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-06-02T18:01:35Z</dc:date>
    </item>
    <item>
      <title>Re: Converting SAS code to SQL</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Converting-SAS-code-to-SQL/m-p/274837#M19071</link>
      <description>&lt;P&gt;Assuming CODE in all these three tables has no duplicated value. i.e. its value is unique.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data master1;
 set sashelp.class;
 rename name=code;
run;

data client ;
 set sashelp.class;
 if _n_=8 then stop;
 rename name=code age=new_age1;
 keep name age;
run;

data abc;
 set sashelp.class;
 if _n_=4 then stop;
 rename name=code age=new_age2;
 keep name age;
run;


proc sql;
select a.*,b.new_age1,c.new_age2,not missing(c.code) as abc
 from master1 as a left join client as b on a.code=b.code
   left join abc as c on a.code=c.code;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Jun 2016 01:52:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Converting-SAS-code-to-SQL/m-p/274837#M19071</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-06-03T01:52:41Z</dc:date>
    </item>
  </channel>
</rss>

