BookmarkSubscribeRSS Feed
DPraba79
Calcite | Level 5
Hi,

I have a sas date set with 20 colums, say COL A,B,C... . i want to know the unive value of COL A and unique values of COL B and so on. I have a idea to read the same dataset 20 times and get rid of duplicates, but i think this is not an efficeint way of coding.

Could you please help me out of this problem
3 REPLIES 3
Cynthia_sas
SAS Super FREQ
Hi:
I always find it useful to look at a concrete example of data when talking about duplicates. Consider this data:
[pre]
Obs a b c d e

1 A AA 1 4 3
2 A AA 1 4 3
3 A AA 2 8 3
4 A BB 4 5 6
5 A CC 7 8 3
6 B AA 1 8 3
7 B AA 1 8 3
8 B BB 1 4 3
9 B BB 4 5 6
10 B CC 5 6 7

[/pre]

Would you want to get RID of Observations 2 and 7 which are complete duplicates on EVERY column?

Or do you just want to find out what the unique values are? Something like this (produced by PROC FREQ):
[pre]
Number of Variable Levels

Variable Levels
--------------------
a 2
b 3
c 5
d 4
e 4


a Frequency
--------------
A 5
B 5


b Frequency
---------------
AA 5
BB 3
CC 2


c Frequency
--------------
1 5
2 1
4 2
5 1
7 1


d Frequency
--------------
4 3
5 2
6 1
8 4


e Frequency
--------------
3 6
6 2
7 1
9 1

[/pre]

It is also hard to make a recommendation without knowing what the outcome is supposed to be -- a report -- another data set???

Your best bet for help might be to contact Tech Support, because they can look at your data and figure out the best method in EG to accomplish your goal.

cynthia
DPraba79
Calcite | Level 5
Hi, I need the PROC FREQ , Could you please send me the code
Cynthia_sas
SAS Super FREQ
Hi,
Here's the code I used.
[pre]
proc freq data=testfile nlevels;
table a b c d e / nocum nopercent;
run;

[/pre]
cynthia

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!

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
  • 3 replies
  • 661 views
  • 0 likes
  • 2 in conversation