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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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