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;

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