BookmarkSubscribeRSS Feed
boin
Obsidian | Level 7
  • I Have a data set with the below values

Employee   Manager

sam             Niro

kevin            Daniel

george          Peter

niro                Leo

daniel             David

peter               Leo

david               Leo

another data set

EMPLOYEE

sam

kevin

george

niro

daniel

peter

david

leo

i want the output the output data set to be

employee  Manager

sam            Niro

kevin            Daniel

George       Peter

niro              Leo

daniel           David

peter             Leo

david             Leo

leo



please assist with the above..

2 REPLIES 2
AncaTilea
Pyrite | Level 9

How about this?;

data one;

input Employee  $ Manager $;

datalines;

sam             Niro

kevin            Daniel

george          Peter

niro                Leo

daniel             David

peter               Leo

david               Leo

;

data two;

input EMPLOYEE $;

datalines;

sam

kevin

george

niro

daniel

peter

david

leo

;

proc sort data = one;by employee;

proc sort data = two;by employee;

data want;

    merge one two;

    by employee;

run;

Good luck,

Anca.

*alternatively;

proc sql;

    create table want as

    select a.manager,b.employee

    from one as a full join two as b

    on a.employee = b.employee;

quit;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

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
  • 2 replies
  • 427 views
  • 1 like
  • 2 in conversation