# Percentiles for RTRA

percentiles-rtra.pdf (PDF, 221.41 KB)

## Basic Percentiles for RTRA

1. A percentile is the value of a variable below which a certain percent of observations fall. For example, the RTRA percentile procedure can be used to find the median income for males and females. To calculate percentiles, call the following RTRA procedure:

**%RTRAPercentile**(

InputDataset=,

OutputName=,

ClassVarList=,

AnalysisVar=,

Percentiles=,

UserWeight=);

2. **%RTRAPercentile **parameter definition:

**InputDataset**= identify the input data set from the WORK area to be used by the procedure.

**OutputName**= identify the name of the output files you want returned (maximum of 20 characters and the first character must be a letter).

**ClassVarList**= identify a maximum of five variables for the dimensions of the percentile procedure. These variables need to be delimited by spaces or asterisks. Each variable must contain more than one but no more than 500 unique values.

**AnalysisVar**= identify exactly one variable for the percentile procedure. This variable must be of type numeric.

**Percentiles**= identify up to three percentiles from the following list: 1, 5, 10, 20, 25, 30, 40, 50, 60, 70, 75, 80, 90, 95, 99. The percentile values need to be delimited by spaces.

**UserWeight**= refer to the RTRA parameters document to identify a survey weight. The weight variable identified will be merged onto the input data set using the ID variable.

3. Example: This procedure can be used to calculate income percentiles. Suppose you ran the following RTRA procedure to calculate the first quartile, the median, and the third quartile of a variable called "Income" to generate a table named "Table1". You would like to calculate these percentiles for each gender using a variable called "Sex".

Your RTRA procedure call will look like this:

**%RTRAPercentile**(

InputDataset=work.LFS,

OutputName=Table1,

ClassVarList=Education Sex,

AnalysisVar=Income,

Percentiles=25 50 75,

UserWeight=Finalwt);

The following table displays results from the example procedure above.

Sex | Income_P25 | Income_P50 | Income_P75 | Income_Count |
---|---|---|---|---|

20000 | 45000 | 110000 | 27268000 | |

Female | 28000 | 50000 | 100000 | 13448000 |

Male | 16000 | 38000 | 620000 | 13820000 |

Note: Output for surveys with bootstrap weights will have additional information on precision measures i.e. quality indicators, standard errors, confidence intervals, etc. |

## L5 Percentile for RTRA

1. A percentile is the value of a variable below which a certain percent of observations fall. Using the L5 function on Percentiles allows the user to calculate the difference between other statistics being run. For example, the RTRA L5 percentile procedure can be used to find the median income for males and females, while identifying a Percent Change. To calculate L5 percentiles, call the following RTRA procedure:

**%RTRAPercentileL5**(

InputDataset=,

OutputName=,

ClassVarList=,

AnalysisVar=,

Percentiles=,

L5STAT=,

L5TYPE=,

L5BYVAR=,

USERWEIGHT=);

2. **%RTRAPercentileL5 **parameter definition:

**InputDataset**= identify the input data set from the WORK area to be used by the procedure.

**OutputName**= identify the name of the output files you want returned (maximum of 20 characters and the first character must not be an underscore)

**ClassVarList**= identify a maximum of five variables for the dimensions of the percentile procedure. These variables need to be delimited by spaces or asterisks. Each variable must contain more than one but no more than 500 unique values.

**AnalysisVar**= identify exactly one variable for the percentile procedure. This variable must be of type numeric.

**Percentiles**= identify up to three percentiles from the following list: 1, 5, 10, 20, 25, 30, 40, 50, 60, 70, 75, 80, 90, 95, 99. The percentile values need to be delimited by spaces.

**L5Stat =**identify which higher-order statistic you would like to use. The selection must be one of the following: LC (for Level Change), PC (for Percent Change), or ST (for Significance Test).

**L5ByVar =**identify the BY variable. The specified variable must also exist in the ClassVarList.

**L5BaseVal =**identify how the values in the table cells will compare to one another. The selection must be one of the following: Sequential, Base, or Global.

**UserWeight**= refer to the RTRA parameters document to identify a survey weight. The weight variable identified will be merged onto the input data set using the ID variable.

3. Example: This procedure can be used to calculate income percentiles by sex with a percentage change. Suppose you ran the following RTRA procedure to calculate the first quartile, the median, and the third quartile of a variable called "Income" to generate a table named "Table2". You would like to calculate these percentiles for each gender using a variable called "Sex".

Your RTRA procedure call will look like this:

**%RTRAPercentileL5**(

InputDataset=work.LFS,

OutputName=Table2,

ClassVarList=Sex,

AnalysisVar=Income,

Percentiles=25 50 75,

L5STAT=PC,

L5TYPE=global,

L5BYVAR=Sex,

USERWEIGHT=Finalwt);

The following table displays results from the example procedure above.

Sex | Income_P25 | Income_P50 | Income_P75 | Income_P25_PCG | Income_P50_PCG | Income_P75_PCG | Income_Count |
---|---|---|---|---|---|---|---|

1640 | 2200 | 2600 | 0 | 0 | 0 | 231750 | |

Female | 1510 | 2200 | 2550 | -0.08 | 0 | -0.0192 | 94250 |

Male | 1800 | 2250 | 2600 | 0.101 | 0.023 | 0 | 137500 |

Note:Output for surveys with bootstrap weights will have additional information on precision measures i.e. quality indicators, standard errors, confidence intervals, etc. |

## L5SOT Percentile for RTRA

1. This is the RTRA procedure macro for producing Percentile tabulations which include a selected Level 5 Sequential Over Time (L5SOT) statistic. A percentiles is the value of a variable below which a certain percent of observations fall. For example, the RTRA percentile procedure can be used to find the median income for males and females. To calculate percentiles, call the following RTRA procedure:

**%RTRAPercentileL5SOT**(

InputDataset=,

OutputName=,

ClassVarList=,

AnalysisVar=,

Percentiles=,

L5Stat=,

L5YrVar=,

L5MonVar=,

L5QtrVar=,

UserWeight=);

2. **%RTRAPercentileL5SOT **parameter definition:

**InputDataset**= identify the input data set from the WORK area to be used by the procedure.

**OutputName**= identify the name that is to be given to the final output files corresponding to this call to RTRAPercentileL5SOT. The post-processing parameters data set defines the correspondence between the internally generated name and the final output file names.

**ClassVarList**= identify a maximum of five variables for the dimensions of the percentile procedure. These variables need to be delimited by spaces or asterisks.

**AnalysisVar**= identify exactly one variable for the percentile procedure. This variable must be of type numeric.

**Percentiles**= identify up to three percentiles from the following list: 1, 5, 10, 20, 25, 30, 40, 50, 60, 70, 75, 80, 90, 95, 99. The percentile values need to be delimited by spaces.

**L5Stat**= Valid values are LC, PC and ST (case insensitive).

**L5YrVar**= identifies the name of the variable used as the Level 5 year variable.

**L5MonVar**= (optional) identifies the Level 5 month variable. Valid to omit this parameter or specify blank. If L5MonVar is specified then L5 QtrVar must be blank or omitted

**L5QtrVar**= (optional) identifies the Level 5 quarter variable. Valid to omit this parameter or specify blank. If L5 QtrVar is specified then L5MonVar must be blank or omitted.

**L5TimeInt**= (optional) identifies the Level 5 time interval. Value specified must be an integer greater than 0. Valid to omit this parameter but default integer must be 1.

**UserWeight**= Refer to the RTRA parameters document to identify a survey weight. The weight variable identified will be merged onto the input data set using the ID variable.

3. Example: This procedure can be used to analyze the Percent Change in weekly earnings based on different genders throughout the year.

**%RTRAPercentileL5SOT**(

InputDataset=work.LFS,

OutputName=Table3,

ClassVarList=Sex,

AnalysisVar=NUM_WKLYEARN,

Percentiles = 25 50 75,

L5Stat=PC,

L5YrVar=NUM_SYEAR,

L5MonVar=NUM_MONTH,

L5TimeInt=1,

UserWeight=FINALWT);

The following table displays results from the example procedure above. Please note that this is a section of the data in the documentation and a select few entries of the actual output have been pulled for the purpose of having smaller outputs. For this example we will only use results for the first third of the year 2016 with a 25% change.

NUM_MONTH | SEX | NUM_WKLYEARN_P25 | NUM_WKLYEARN_P25_PCS | NUM_WKLYEARN_COUNT |
---|---|---|---|---|

January | Male | 1500 | 0 | 6750 |

January | Female | 1730 | 0 | 12250 |

February | Male | 2100 | 0.4 | 9750 |

February | Female | 1900 | 0.101 | 15500 |

March | Male | 2000 | -0.048 | 11750 |

March | Female | 1550 | -0.184 | 14000 |

April | Male | 2000 | 0 | 8500 |

April | Female | 1200 | -0.23 | 14750 |

Note: Output for surveys with bootstrap weights will have additional information on precision measures i.e. quality indicators, standard errors, confidence intervals, etc. |

- Date modified: