<?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: inner join in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/INNER-JOIN-ERROR/m-p/822742#M41034</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;on pid&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;on its own would only test for Boolean "true" values in a single variable (not zero and not missing).&lt;/P&gt;
&lt;P&gt;To check for the equality of the pid variables in both datasets, you need to say so:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;on a.pid = b.pid&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 12 Jul 2022 04:30:55 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2022-07-12T04:30:55Z</dc:date>
    <item>
      <title>INNER JOIN ERROR</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/INNER-JOIN-ERROR/m-p/822720#M41026</link>
      <description>&lt;P&gt;I'm trying to do an inner join in the final step on pid but I'm getting an error (I posted the previous two data steps for reference):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
/*DENOMINATOR - merge to get dx rank for the dx codes*/
/*ran successfully and the ddate column populates correctly per the formula*/
data denom_final;
length dx $100;
merge opipdata (in=ina) 
      out.diag;
by pid;
format ddate yymmdd10.;
if ina;
if ((dxpos = 1 and dx in &amp;amp;aaa) then condition = "AAA";
if ((dxpos = 1 and dx in &amp;amp;ccc)  then condition = "CCC";
if ((dxpos  = 1 and dx in &amp;amp;ppp then condition = "PPP";
if ((dxpos = 1 and dx in &amp;amp;ppp)  then condition = "OOO";
if ((dxpos = 1 and dx in &amp;amp;ddd) then condition = "DDD";
if ((dxpos = 1 and dx in &amp;amp;hhh)  then condition = "HHH";

/*op data will not have disc date so create variable for when dischdate is missing and replace with edate*/

if missing(input(dischdate,yymmdd10.))then ddate= input(edate,yymmdd10.);
	else ddate= input(dischdate,yymmdd10.);
run;


/*NUMERATOR*/
/*RAN SUCCESSFULLY*/
proc sql;
create table numerator
as select
id,
pid,
dx,
edate as ndate,
admitdate,
dischdate
from
detailstable
where dx in &amp;amp;aaa_suff OR dx in &amp;amp;ccc_suff OR dx in &amp;amp;ooo_suff OR dx in &amp;amp;ppp_suff 
OR dx in &amp;amp;ddd_suff OR dx in &amp;amp;hhh_suff
OR 
dx in &amp;amp;aaa_rel OR dx in &amp;amp;ccc_rel OR dx in &amp;amp;ooo_rel OR dx in &amp;amp;ppp_rel OR 
dx in &amp;amp;diab_rel OR dx in &amp;amp;htn_rel)
AND edate between '01Jan2021' and '31Dec2021'
and (rev in &amp;amp;ED_REV or rev in &amp;amp;OBS_REV or cpt in &amp;amp;ED_CPT or cpt in &amp;amp;OBS_CPT) 
order by pid;
quit;


proc sql;
create table combined
as select 
id,
pid,
a.ddate,
b.ndate
from 
denom_final a inner join numerator b
on pid;
quit;
ERROR: Ambiguous reference, column pid is in more than one table.
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 02:28:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/INNER-JOIN-ERROR/m-p/822720#M41026</guid>
      <dc:creator>bhca60</dc:creator>
      <dc:date>2022-07-12T02:28:01Z</dc:date>
    </item>
    <item>
      <title>Re: INNER JOIN ERROR</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/INNER-JOIN-ERROR/m-p/822725#M41027</link>
      <description>&lt;P&gt;This logic does not look very valid.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if ((dxpos = 1 and dx in &amp;amp;aaa) OR 
	(dxpos = 1 and dx in &amp;amp;aaa_rel AND dxpos &amp;gt; 1 and dx in &amp;amp;aaa_suff)) then condition = "AAA";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Are you sure you want to test if a single instance of DX is both the list stored in AAA_REL and in the list stored in AAA_SUFF?&lt;/P&gt;
&lt;P&gt;If so why not just test whether DX is in the smaller list of that is the intersection of the two lists?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suspect that you want to check if ANY of a series of DX values are in the first list and if some other DX in the series is also in the second list.&amp;nbsp; If so then you will need something different.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please show 4 or 5 values of DX and examples of the values in the two list and say what you want to do with them?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also how do you have many values of DX?&amp;nbsp; Are there multiple variables in a single observation?&amp;nbsp; Like DX1, DX2, etc? Or multiple observations?&amp;nbsp; Either way to test if ANY (or ALL) of the DX values are in some list you need to add more logic.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 01:21:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/INNER-JOIN-ERROR/m-p/822725#M41027</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-07-12T01:21:00Z</dc:date>
    </item>
    <item>
      <title>inner join</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/INNER-JOIN-ERROR/m-p/822730#M41033</link>
      <description>&lt;P&gt;I'm getting an error and just trying to join two tables on pid:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table combined
as select 
id,
pid,
a.ddate,
b.ndate
from 
denom_final a inner join numerator b
on pid;
quit;
ERROR: Ambiguous reference, column pid is in more than one table.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Jul 2022 01:40:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/INNER-JOIN-ERROR/m-p/822730#M41033</guid>
      <dc:creator>bhca60</dc:creator>
      <dc:date>2022-07-12T01:40:21Z</dc:date>
    </item>
    <item>
      <title>Re: INNER JOIN ERROR</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/INNER-JOIN-ERROR/m-p/822736#M41030</link>
      <description>I fixed it to just bring in those in position one</description>
      <pubDate>Tue, 12 Jul 2022 02:26:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/INNER-JOIN-ERROR/m-p/822736#M41030</guid>
      <dc:creator>bhca60</dc:creator>
      <dc:date>2022-07-12T02:26:10Z</dc:date>
    </item>
    <item>
      <title>Re: INNER JOIN ERROR</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/INNER-JOIN-ERROR/m-p/822737#M41031</link>
      <description>&lt;P&gt;You need to identify which PID you want to read:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table combined
as select 
id,
a.pid,
a.ddate,
b.ndate
from 
denom_final a inner join numerator b
on a.pid = b.pid;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Jul 2022 02:44:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/INNER-JOIN-ERROR/m-p/822737#M41031</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-07-12T02:44:31Z</dc:date>
    </item>
    <item>
      <title>Re: inner join</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/INNER-JOIN-ERROR/m-p/822742#M41034</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;on pid&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;on its own would only test for Boolean "true" values in a single variable (not zero and not missing).&lt;/P&gt;
&lt;P&gt;To check for the equality of the pid variables in both datasets, you need to say so:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;on a.pid = b.pid&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Jul 2022 04:30:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/INNER-JOIN-ERROR/m-p/822742#M41034</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-07-12T04:30:55Z</dc:date>
    </item>
    <item>
      <title>Re: inner join</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/INNER-JOIN-ERROR/m-p/822743#M41035</link>
      <description>&lt;P&gt;Please do not post the same question twice.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 04:34:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/INNER-JOIN-ERROR/m-p/822743#M41035</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-07-12T04:34:00Z</dc:date>
    </item>
  </channel>
</rss>

