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;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

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
  • 1 reply
  • 373 views
  • 0 likes
  • 2 in conversation