Help using Base SAS procedures

Alternative of EXCEPT operator in Data Step

Reply
Occasional Contributor
Posts: 15

Alternative of EXCEPT operator in Data Step

Hello everyone,

I am having a table name employee_organization which consist of all employee name of the organization and  employee_sales employee name of sales department

Employee_id  Dept

1453253         Accounts

7866341         Sales

2333642         HR

4566333         Accounts

2223355         Operation

Employee_id  Dept

7866341         Sales

I want to get the output of all employees which are not from Sales department. It is possible by using PROC SQL SAS Except operator.

I would like to know how it is possible to achieve aforementioned task using DATA Step

Thanks in advance 

Valued Guide
Posts: 858

Re: Alternative of EXCEPT operator in Data Step

ne stands for not equal to:

data have;

infile cards;

input Employee_id$  Dept$;

cards;

1453253         Accounts

7866341         Sales

2333642         HR

4566333         Accounts

2223355         Operation

;

data want;

set have;

where dept ne 'Sales';

run;

Occasional Contributor
Posts: 15

Re: Alternative of EXCEPT operator in Data Step

Thanks for the reply

Actually as EXCEPT operator perform vertically on the table. I was in dilemma is there any way of using SET statement in data step

Super User
Super User
Posts: 7,401

Re: Alternative of EXCEPT operator in Data Step

You can achieve this in any language in a variety of ways. 

data step - where clause, if then clause

sql - where clause

This is basic SAS operation, and can be found here:

SAS(R) 9.2 Language Reference: Dictionary, Fourth Edition

Base SAS(R) 9.2 Procedures Guide

Ask a Question
Discussion stats
  • 3 replies
  • 342 views
  • 0 likes
  • 3 in conversation