BookmarkSubscribeRSS Feed
mansour_ib_sas
Pyrite | Level 9

 

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;
3 REPLIES 3

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

Register now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1060 views
  • 0 likes
  • 2 in conversation