How do I convert the levels of a SAS variable to percentages?
Use PROC RANK. In the following example, the variable PRCNTS is created to contain the percentage values for the ranks assigned to the values of the original variable VAR1. Both variables will be contained in the output dataset ROUT. Note that it is the P option in the PROC RANK statement that directs SAS to divide each rank by the number of nonmissing observations and multiply by 100 to get a percentage.
PROC RANK DATA=insds P OUT = rout ;
VAR var1 ;
RANKS prcnts ;
For more information, click on the Help button in the SAS menu bar and scroll to SAS Help and Documentation.
If you have further questions, send E-mail to stats@ssc.utexas.edu.