DATA Step, Macro, Functions and more

Distnict values for a Column

Reply
Occasional Contributor
Posts: 19

Distnict values for a Column

Hi All.

 

I have a huge dataset which has various coulmns(variables).

I want to find different values that exist in the dataset for a particular variable.

 

Thanks in advance 

Vishyy

 

Contributor
Posts: 56

Re: Distnict values for a Column

Two approaches I use often.

 

PROC SQL

proc sql;
  create table WANT as
    select DISTINCT VARIABLE
    from HAVE;
quit;

SORT PROCEDURE

proc sort data=HAVE(keep=VARIABLE) nodupkey out=WANT;
  by VARIABLE;
run;
Super User
Posts: 5,503

Re: Distnict values for a Column

To get just a little more information, you could try:

 

proc freq data=have;

tables variable / missing;

run;

 

Now you'll see how often each value appears in your data set.

Ask a Question
Discussion stats
  • 2 replies
  • 97 views
  • 0 likes
  • 3 in conversation