/* this is my data set */ data have;
input col1 $ col2 col3 $ col4 col5;
cards;
Jac 10 s 1 0
Joe 31 s 1 0
Joe 22 l 2 0
Roe 33 l 1 1
Rex 44 s 1 0
Tim 24 s 1 0
Joe 31 s 2 0
Joe 22 l 1 1
Roe 33 l 2 1
Rex 44 s 1 1
Tim 24 s 1 1
;
run; until now I have achieved this result bu it's not exactly what I want the result is just for col1 I want for all columns (col1 col2 ...) you can see in the function %unicite(have,want,col1); %macro unicite(entree,sortie,col); %let list=col1 col2 col3 col4 col5 ; data TABLE_INSPECTION; set _NULL_; run; %do index = 1 %to %sysfunc(countw(&list,%str( ))); %let I =%scan(&list,&index,%str( )); PROC SQL OUTOBS=1 ; CREATE TABLE &sortie AS SELECT (COUNT(DISTINCT(&I))) AS &I FROM &entree GROUP BY &col ORDER BY &I DESC; QUIT; data TABLE_INSPECTION; set TABLE_INSPECTION &sortie; run; proc delete data=&sortie; run; %end; %mend; %unicite(have,want,col1);
... View more