BookmarkSubscribeRSS Feed
elsfy
Quartz | Level 8

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

1 REPLY 1
AMSAS
SAS Super FREQ

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;
How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 793 views
  • 0 likes
  • 2 in conversation