BookmarkSubscribeRSS Feed
Son_Of_Krypton
Fluorite | Level 6

Hi Have number of tables in work library and want to combined result of below query in a one table 

SELECT count(distinct Client_Key)
FROM work.Table_C
WHERE Memberstatus='Existing'
SELECT count(distinct Client_Key) FROM work.Table_2019_07_jul WHERE Memberstatus='Existing' SELECT count(distinct client_key) FROM work.Table_2019_06_jun WHERE Memberstatus='Existing' SELECT count(distinct Client_Key) FROM work.Table_2019_05_may WHERE Memberstatus='Existing'

 

1 REPLY 1
Kurt_Bremser
Super User
proc sql;
create table all as
  select count(distinct Client_Key) as count
  from work.Table_C
  where Memberstatus='Existing'
union all
  select count(distinct Client_Key) as count
  from work.Table_2019_07_jul
  where Memberstatus='Existing'
union all
  select count(distinct client_key) as count
  from work.Table_2019_06_jun
  where Memberstatus='Existing'
union all
  select count(distinct Client_Key) as count
  from work.Table_2019_05_may
  where Memberstatus='Existing'
;
quit;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1 reply
  • 691 views
  • 0 likes
  • 2 in conversation