SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

Retaining unique values in same order

Accepted Solution Solved
Reply
Contributor sss
Contributor
Posts: 65
Accepted Solution

Retaining unique values in same order

Hi All,

 

I have small query, I want to generate unique records from temp dataset on variable var, but the out dataset should have values in same order a c d b e.

 

Output:

----------
a
c
d
b
e

 

data temp;
input var$;
datalines;
a
a
a
c
c
c
d
b
b
b
e
e
;
run;


Accepted Solutions
Solution
‎10-30-2015 12:47 AM
Respected Advisor
Posts: 4,919

Re: Retaining unique values in same order

Use by var notsorted :

 


data tempNoDup;
set temp; by var notsorted;
if first.var then output;
run;

proc print; run;
PG

View solution in original post


All Replies
Solution
‎10-30-2015 12:47 AM
Respected Advisor
Posts: 4,919

Re: Retaining unique values in same order

Use by var notsorted :

 


data tempNoDup;
set temp; by var notsorted;
if first.var then output;
run;

proc print; run;
PG
🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 246 views
  • 1 like
  • 2 in conversation