Hi everyone,
a quick question. i have a table (Table A) that contains two columns looking like this
Group
ID
A
24
A
54
A
92
A
6
A
7
B
25
B
11
B
97
C
13
C
18
D
81
D
10
Then I have a very large table (table B) from which i want to extract data based on the group and ID in a proc sql.
For a number of reasons, I wont be able to use a left join or inner join statement, so I am trying to come up with a different approach that would look like this
proc sql,
create table TABLEC as
select *
from tableB
where &selection
the macro variable &selection should be generated dynamically based on tableA and should at the end look like this
(group=A and ID in (24, , 54, 92, 6, 7) ) OR
(group=B and ID in (25, 11, 97)) OR
(group=C and ID in (13, 18)) OR
(group=D and ID in (81, 10))
The number and name of groups is variable so the code should account for that too. The only thing that wont change is the name of columns (group, ID).
Has anyone done something similar before?
Yes, I know left join makes more sense but as I said, I need to this differently...
Thanks
Am
... View more