Proc SQL Select Distinct

Reply
Contributor
Posts: 47

Proc SQL Select Distinct

Can someone explain to me what this code is doing?

 

PROC SQL;
CREATE TABLE summary AS
SELECT DISTINCT id, COUNT(id) AS fuentries
FROM EDB.event
GROUP BY id;
QUIT;

 

What is fuentries?

 

Thanks!

 

Contributor
Posts: 25

Re: Proc SQL Select Distinct

hi,

How many are there to counts for every id.

 

you did not have to use DISTINCT. because you use group by function.

 

data have;
infile cards truncover dlm=',';
input key id ;
cards;
1,1
2,1
3,1
4,1
5,1
6,2
7,2
8,2
9,2
10,3
11,3
12,4
13,4
14,4
15,4
;
run;

 

PROC SQL;
CREATE TABLE summary AS
SELECT id, COUNT(id) AS fuentries
FROM work.have
GROUP BY id;
QUIT;

 

 

id fuentries
1	5
2	4
3	2
4	4

best regards.

Ask a Question
Discussion stats
  • 1 reply
  • 589 views
  • 0 likes
  • 2 in conversation