Hi,
I would like to know the equivalent of proc sql count distinct operation.
I want to count the number of contrats and the number of people in a dataset but for my purpose i want to do it in a proc report (if possible).
So i have id_contrat and id_person that are non numeric variables and i only managed to calculate the number of contrats corresponding to the number of observations. I don't want to display each id_contrat nor id_person.
I did this so far :
proc report data = a ;
columns ('Perimeter' var_to_group_by n) ;
define var_to_group_by / group ;
define n / 'nb_contracts' ;
run ;
Thanks
Like this?
See REPORT Procedure
data have ;
do group=1 to 3 ;
do members=1 to int(ranuni(0)*10) ;
output ;
end ;
end ;
run ;
proc report data=have ;
column group members ;
define group/group ;
define members/analysis n ;
run;
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 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.