Tables and axes > Statistical functions and totals > Creating percentiles and medians > Percentiles from factors
 
Percentiles from factors
Percentiles with factors are created with an n30 formatted as follows:
n30[Text]; fac=n[;dec=p]
where:
n is a number between 1 and 100 indicating the desired percentile level; for example, fac=50 for the median, fac=10 for the first decile, and so on.
p is the number of decimal places required. The default is dec=0.
The n30 must follow a set of n01/n15/col/val statements with factors defining the ‘weight’ to be used for each element. The normal practice is to set the factors to the highest point of each range. When the highest response caters for all values over a certain amount, you need to give careful consideration to the value you give its factor. The statements must be arranged so that the factors are listed in ascending sequence. Quantum uses the factors to create the percentile value.
For example, you might have ranges of income coded into c281. You could set up the axis for medians and quartiles as follows:
l income
n10Base
n23Household Income (in Pounds)
n01No Income;c=c281'0';fac=0
col 281;1-1000;%fac=1000+1000;
+1001-2000;2000-3000;3001-4000;4001-5000;5001-6000;
+6001-7000;7001-8000;8001-9000;9001-10000;
+10001-10500='–';%fac=10500+500;10501+='&'
n03
n30Lower Quartile;fac=25;dec=2
n30Median Income;fac=50;dec=2
n30Upper Quartile;fac=75;dec=2
The effort involved in writing out this axis has been minimized by using a col statement instead of n01s. However, to show only the statistics (that is, the three n30 rows), you must suppress the other rows either by writing each one separately on an n15, or by using the option smsupa= on the rows to be suppressed.
If the midpoint is in the range 6001-7000, Quantum will interpolate to produce a median value of, say, 6258.
Note The requirements for setting factors for percentiles can sometimes result in the factors being unsuitable for creating means.
See
How Quantum interpolates percentiles from factors
Factors in reverse order
Troubleshooting
See also
Creating percentiles and medians