BookmarkSubscribeRSS Feed
samirt
Fluorite | Level 6

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 

3 REPLIES 3
Steelers_In_DC
Barite | Level 11

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;

samirt
Fluorite | Level 6

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

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1972 views
  • 0 likes
  • 3 in conversation