I was wondering If there is a way to remove duplicate column values without removing the entire row. This is purely for formatting, and i'd just like to take a step out of my manual workflow.
Basically I'd like to turn this:
Location | Departments |
---|---|
Location 1 | 5400 |
Location 1 | 5401 |
Location 2 | 5402 |
Location 2 | 5403 |
Into this:
Location | Departments |
---|---|
Location 1 | 5400 |
5401 | |
Location 2 | 5402 |
5403 |
Thanks.
Here you go:
data have;
infile cards dsd dlm=',';
length location $10.;
input Location $ Departments $;
cards;
Location 1,5400
Location 1,5401
Location 2,5402
Location 2,5403
;
run;
proc print data=have;id location;by location;
Hi,
And, PROC REPORT will do this for you too.
cynthia
proc report data=have nowd;
column location departments;
define location / order;
define departments /display;
run;
Alternatively you could achieve the same in a datastep by
data want;
set have;
by location;
if not first.location then location='';
run;
Thanks,
Jag
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: