<?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 Joins in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Joins/m-p/815393#M34202</link>
    <description>&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;I have imported a file in SAS and now adding few more details in that file but I am getting the below error. I feel it's a issue in joining. Please suggest&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;Error Log:

29         proc sql;
30           create table Manual_tracing as
31         
32         select a.*,
33         
34         	   	       b.debt_code,
35         			   b.tran_code,
36                        b.tx_date,
37                        b.tx_time,
38         			   b.dt_tx_date,
39                        b.tx_manauto,
40                        b.op_code,
41                        b.tx_char_i11,
42                        c.td_altdescrn,
43         			   c.td_stddescrn
44         
45                 from p2scflow.debt_trans as b
46         		inner join b on a.debt_code = b.debt_code
47                 inner join p2scflow.transdescrn as c
48                 on b.Tran_code = c.Tran_code
49                 where  b.tran_code in ('MO9741','MO9742','MO9743','MO9744','MO9745','MO9746','MO9747','MO9748')
50         
51         	order by a.debt_code
52         ;
ERROR: File WORK.B.DATA does not exist.
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
2                                                          The SAS System                               13:44 Thursday, May 26, 2022

53         quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=""&gt;Proc import 
datafile='\\test.local\shares\public\Full_manual_trace_book.csv'
out=Manual_trace_full
dbms=csv
replace;
run;


proc sql;
  create table Manual_tracing as
select a.*,
 b.debt_code,
b.tran_code,
 c.td_altdescrn,
  c.td_stddescrn
             
        from p2scflow.debt_trans as b
		inner join b on a.debt_code = b.debt_code
        inner join p2scflow.transdescrn as c
        on b.Tran_code = c.Tran_code
        where  b.tran_code in ('SO971','SO972') 
	order by b.debt_code;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 27 May 2022 12:46:43 GMT</pubDate>
    <dc:creator>Sandeep77</dc:creator>
    <dc:date>2022-05-27T12:46:43Z</dc:date>
    <item>
      <title>Joins</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Joins/m-p/815393#M34202</link>
      <description>&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;I have imported a file in SAS and now adding few more details in that file but I am getting the below error. I feel it's a issue in joining. Please suggest&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;Error Log:

29         proc sql;
30           create table Manual_tracing as
31         
32         select a.*,
33         
34         	   	       b.debt_code,
35         			   b.tran_code,
36                        b.tx_date,
37                        b.tx_time,
38         			   b.dt_tx_date,
39                        b.tx_manauto,
40                        b.op_code,
41                        b.tx_char_i11,
42                        c.td_altdescrn,
43         			   c.td_stddescrn
44         
45                 from p2scflow.debt_trans as b
46         		inner join b on a.debt_code = b.debt_code
47                 inner join p2scflow.transdescrn as c
48                 on b.Tran_code = c.Tran_code
49                 where  b.tran_code in ('MO9741','MO9742','MO9743','MO9744','MO9745','MO9746','MO9747','MO9748')
50         
51         	order by a.debt_code
52         ;
ERROR: File WORK.B.DATA does not exist.
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
2                                                          The SAS System                               13:44 Thursday, May 26, 2022

53         quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=""&gt;Proc import 
datafile='\\test.local\shares\public\Full_manual_trace_book.csv'
out=Manual_trace_full
dbms=csv
replace;
run;


proc sql;
  create table Manual_tracing as
select a.*,
 b.debt_code,
b.tran_code,
 c.td_altdescrn,
  c.td_stddescrn
             
        from p2scflow.debt_trans as b
		inner join b on a.debt_code = b.debt_code
        inner join p2scflow.transdescrn as c
        on b.Tran_code = c.Tran_code
        where  b.tran_code in ('SO971','SO972') 
	order by b.debt_code;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 May 2022 12:46:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Joins/m-p/815393#M34202</guid>
      <dc:creator>Sandeep77</dc:creator>
      <dc:date>2022-05-27T12:46:43Z</dc:date>
    </item>
    <item>
      <title>Re: Joins</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Joins/m-p/815420#M34203</link>
      <description>&lt;P&gt;Please examine:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;45                 from p2scflow.debt_trans as b
46         		inner join b on a.debt_code = b.debt_code&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you meant to use Pwscflow.debt_trans the join then you do not list the alias b in that position. What follows a JOIN should be another data source.You syntax says to look for a data set named B which defaults to the Work library&lt;/P&gt;
&lt;P&gt;Since you do not define the alias A anywhere one suspects a couple of typos. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To properly write this join to a different data set something like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;45                 from p2scflow.debt_trans as b
46         		inner join&lt;BR /&gt;                        lib.datasetname as a &lt;BR /&gt;                        on a.debt_code = b.debt_code&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Or possibly you meant the P2scflow.debt_trans to be aliased as A and missed the data set name for the alias B.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The syntax does not require the AS but I use it to make sure my intent of creating an alias is obvious.&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 14:49:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Joins/m-p/815420#M34203</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-05-27T14:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: Joins</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Joins/m-p/815423#M34204</link>
      <description>&lt;P&gt;I tried making those changes&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;Proc import 
datafile='\\test.local\shares\public\Full_manual_trace_book.csv'
out=Manual_trace_full
dbms=csv
replace;
run;

proc sql;
  create table Manual_tracing as
select a.*,
 b.debt_code,
 b.tran_code,
 c.td_altdescrn,
 c.td_stddescrn        
        from p2scflow.debt_trans as b
		inner join manual_trace_full as a on a.debt_code = b.debt_code
        inner join p2scflow.transdescrn as c
        on b.Tran_code = c.Tran_code
        where  b.tran_code in ('SO971','SO972') 
order by b.debt_code;
quit;

I am getting this error now:

29         proc sql;
30           create table Manual_tracing as
31         
32         select a.*,
34         	   	b.debt_code,
35         		b.tran_code,
42                        c.td_altdescrn,
43         		  c.td_stddescrn
44         
45                 from p2scflow.debt_trans as b
46         		inner join manual_trace_full as a on a.debt_code = b.debt_code
47                 inner join p2scflow.transdescrn as c
48                 on b.Tran_code = c.Tran_code
49                 where  b.tran_code in ('SO971','SO972')
50         
51         
52         ;
ERROR: Expression using equals (=) has components that are of different data types.
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
2                                                          The SAS System                               13:44 Thursday, May 26, 2022

53         quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 May 2022 15:11:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Joins/m-p/815423#M34204</guid>
      <dc:creator>Sandeep77</dc:creator>
      <dc:date>2022-05-27T15:11:34Z</dc:date>
    </item>
    <item>
      <title>Re: Joins</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Joins/m-p/815425#M34205</link>
      <description>&lt;P&gt;That means that the variables used in one or possibly both of your ON clauses are not of the same time, one is character and the other is numeric.&lt;/P&gt;
&lt;P&gt;So you will need to make them of the same type for the comparison. That could involve a Put(variable,format) to make the numeric version character as in (dummy code)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;on a.variable = put(b.variable,8. -L)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;OR use input to create a numeric version from the character.&lt;/P&gt;
&lt;P&gt;You will have to look at the properties of your variables such as with Proc Contents to determine which is which.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: a common issue causing like named variables to be of different types is reliance on Proc Import to read multiple data sources. Each separate import makes "guesses" as to variable type and length and may result in different types.&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 15:44:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Joins/m-p/815425#M34205</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-05-27T15:44:37Z</dc:date>
    </item>
  </channel>
</rss>

