Hello,
In SAS EG, is there a way to use the statement count(distinct flob) over (partition by police) as N, like the example for test3 (see code below) and if so, how ?
data test;
input police $ flob $ Other_info $;
datalines;
1 A X1
1 B X1
1 C X1
1 D X1
1 E X1
2 A TR
2 C TR
;
RUN;
PROC SQL;
create table test1 as
select *,
count(distinct flob) as N
from test
group by police;
QUIT;
PROC SQL;
create table test2 as
select *,
count(distinct flob) over (partition by police) as N
from test;
QUIT;
Regards,
No.
But you don't need it in SAS.
Just use your first example with the normal GROUP BY and SAS will remerge the count onto the appropriate values of A.
No.
But you don't need it in SAS.
Just use your first example with the normal GROUP BY and SAS will remerge the count onto the appropriate values of A.
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!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: