Assuming you want to categorize all columns of your dataset, otherwise you have to
refine the SQL query.
I use Ksharp's solution, proc rank, which I didnt know of. It is only slightly adapted to
automatically generate the variables and ranks names.
Here the source dataset's name is "prices"
proc sql;
SELECT NAME, cats("RANK_",NAME)
INTO :cols SEPARATED BY ' ',
:ranks SEPARATED BY ' '
FROM dictionary.columns
WHERE LIBNAME="WORK" AND MEMNAME="PRICES" /* AND other restrictions */; /* /!\ use upper case here */
quit;
proc rank data=prices out=want groups=10;
var &cols.;
ranks &ranks.;
run;
... View more