BookmarkSubscribeRSS Feed
themanwith2thum
Calcite | Level 5

I have two sales data one from April the other one from May. The data sets are on transaction level.

 

The April sales data looks like following

Transaction_Date Location_Number Client_Name

March 01              001                         aaa

March 05              087                         aaa

March 02              055                         bbb

March 09              001                         bbb

March 05              002                         ccc

March 06              002                         ccc

march 07              055                         ccc

 

The May data set looks like the following

Transaction_Date Location_Number Client_Name

May 01              001                         aaa

May 05              087                         aaa

May 02              055                         bbb

May 09              001                         bbb

May 05              002                         ccc

May 06              002                         ccc

May 07              055                         ccc

May 06              002                         ddd

May 07              055                         ddd

May 01              001                         eee

May 05              087                         eee

 

Client_Name now has ddd and eee as new clients which weren't there before. So I want to create a table which will have information for these new clients which I have added, so that the table looks like following

 

May 06              002                         ddd

May 07              055                         ddd

May 01              001                         eee

May 05              087                         eee

 

Any advice on how I would go about this? Thanks in advance!

1 REPLY 1
Reeza
Super User
proc sql;
create table want as
select * from table1 where client_name not in (select distinct client_name from table2);
quit;

SQL is usually the easiest method.


@themanwith2thum wrote:

I have two sales data one from April the other one from May. The data sets are on transaction level.

 

The April sales data looks like following

Transaction_Date Location_Number Client_Name

March 01              001                         aaa

March 05              087                         aaa

March 02              055                         bbb

March 09              001                         bbb

March 05              002                         ccc

March 06              002                         ccc

march 07              055                         ccc

 

The May data set looks like the following

Transaction_Date Location_Number Client_Name

May 01              001                         aaa

May 05              087                         aaa

May 02              055                         bbb

May 09              001                         bbb

May 05              002                         ccc

May 06              002                         ccc

May 07              055                         ccc

May 06              002                         ddd

May 07              055                         ddd

May 01              001                         eee

May 05              087                         eee

 

Client_Name now has ddd and eee as new clients which weren't there before. So I want to create a table which will have information for these new clients which I have added, so that the table looks like following

 

May 06              002                         ddd

May 07              055                         ddd

May 01              001                         eee

May 05              087                         eee

 

Any advice on how I would go about this? Thanks in advance!


 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 259 views
  • 0 likes
  • 2 in conversation