BookmarkSubscribeRSS Feed
carmendee
Obsidian | Level 7

Example data

Supervisor Empl Eval_Date Score

Johnson    Smith 1/1/15       25

Johnson    Miller 1/1/15       26

Hanson     Poole 1/2/15       25

 

Desired Ouput:

Name        Eval_Date  Score

Johnson    

Smith        1/1/15          25

Miller         1/1/15         26

Hanson

Poole        1/2/15          25

 

I'm trying to accomplish this without a proc but can if I need to.

2 REPLIES 2
Astounding
PROC Star

I'm not certain that this is a good idea, but here's one way:

 

data want;

set have;

by Supervisor notsorted;

if first.Supervisor then do;

   Name = Supervisor;

   output;

end;

Name = Empl;

D = Eval_Date;

S = Score;

output;

keep Name D S;

rename D = Eval_Date;

rename S = Score;

run;

 

Good luck.

stat_sas
Ammonite | Level 13

Another way using sql

 

data have;
input Supervisor $ Empl $ Eval_Date anydtdte. Score;
format Eval_Date mmddyy8.;
datalines;
Johnson    Smith  1/1/15       25
Johnson    Miller 1/1/15       26
Hanson     Poole  1/2/15       25
;

 

proc sql;
select distinct supervisor as supervisor from have
union
select * from have
order by supervisor, empl;
quit;

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 939 views
  • 1 like
  • 3 in conversation