query to see match and non match records

Hi,
I am running below query an getting match counts for table a and table b, i also want to
see nonmatch records for site_id and dm_id how can i do tht so i want is give me list
of all site_id which no texist in dim_id


   PROC SQL;
  CREATE TABLE test as (
    select
        site_id,DM_ID
      from DIM._DIM a
      inner join stage.pc_dm b
      on input(a.site_id,best32.) = b.DM_ID);
      quit;
sam2929Asked:
Who is Participating?
 
theartfuldazzlerCommented:
Hi

You can use the EXCEPT operator in Proc SQL:

PROC SQL;
 CREATE TABLE test as
   Select input(site_Id,best32.) As dm_Id from dim._dim
  Except
    Select dm_Id from stage.PC_dm;

This selects all site_ids in dim._dim that are not in stage.PC_dm
PROC SQL;
Create table a_notB as
  Select input(a.site_id,best32.) As dm_Id from DIM._DIM
    Except
    Select DM_ID FROM stage.pc_dm;

Open in new window

0
 
sam2929Author Commented:
hi,
with this new expert exchange how can i put my question in sas?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.