BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
DucatiJong
Calcite | Level 5

Hi,

 

When I performs an SQL join with a derived join key, I separates the step into proc sql. One to drive the joinkey and another to actually perform the join. I wonder if someone know of a more efficient way to do this. A simple example below to illustrate,

 

proc sql;

  create view prep_table as

  select * ,put(raw_var, $someformat.) as joinkey

  from main_table;

 

  create table output_table as

  select a.var ,b.var2

  from prep_table as a

    left join sub_table as b

      on a.joinkey = b.joinkey;

  quit;  

1 ACCEPTED SOLUTION

Accepted Solutions
kiranv_
Rhodochrosite | Level 12

but what is point to make another column in the view, unless your building a index or something useful. You can do pretty much in same step as 

 

 

  create table output_table as

  select a.var ,b.var2

  from prep_table as a

    left join sub_table as b

      on put(a.raw_var, $someformat.) = b.joinkey;

  quit;  

  

View solution in original post

2 REPLIES 2
kiranv_
Rhodochrosite | Level 12

but what is point to make another column in the view, unless your building a index or something useful. You can do pretty much in same step as 

 

 

  create table output_table as

  select a.var ,b.var2

  from prep_table as a

    left join sub_table as b

      on put(a.raw_var, $someformat.) = b.joinkey;

  quit;