Hello
I can't understand the idea that was developed in this SQL query.
Multi-calls were used for the Test1 table
Could you please help me with his understanding
Thank You
data test;
input name $ pur_id id;
cards;
A 1 2
B 2 3
C 3 4
D 4 5
E 5 6
F 6 7
G 7 8
H 8 9
I 9 10
J 10 11
K 11 12
;run;
data test1;
input pur_id id;
cards;
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
;run;
proc sql;
create table test2 as select test.name, b.id as id_n1,c.id as id_n2,d.id as id_n3
from test left join test1 as b
on test.pur_id=test1.id
left join test1 as c
on b.pur_id=c.id
left join test1 as d
on c.pur_id=d.id
order by name
;quit;
The code follows a parent-child chain, max. 3 levels deep.
Thank you for your answer,
what is it for?
@mansour_ib_sas wrote:
Thank you for your answer,
what is it for?
Look at the documentation of the code.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.