Mean for RTRA

mean-rtra.pdf (PDF, 222.52 KB)

Basic Mean for RTRA

1. The RTRA mean procedure produces the average for a continuous variable. For example, this procedure can be used to calculate the average income of those with different education levels and gender. To generate a mean, call the following RTRA procedure:

%RTRAMean(
InputDataset=,
OutputName=,
ClassVarList=,
AnalysisVarList=,
UserWeight=);

2. %RTRAMean 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 mean 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.

AnalysisVarList = identify a maximum of three variables for the mean procedure. These variables must be of type numeric. Each of these variables must contain at least four unique values. These variables need to be delimited by spaces or asterisks.

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 average income. Suppose you ran the following RTRA procedure to calculate the mean of a variable called "Income" for a table named "Table1". You would like to calculate this average for different education levels and gender using variables called "Education" and "Sex".

Your RTRA procedure call will look like this:

%RTRAMean(
InputDataset=work.LFS,
OutputName=Table1,
ClassVarList=Education Sex,
AnalysisVarList=Income,
UserWeight=Finalwt);

The following table displays results from the example procedure above.

Table 1
Results from example procedure
Education Sex Income_mean Income_Count
  Female 30000 100
  Male 40000 100
Above high school Female 35000 60
Above high school Male 50000 55
Below high school Female 25000 40
Below high school Male 30000 45
Note: Output for surveys with bootstrap weights will have additional information on precision measures i.e. quality indicators, standard errors, confidence intervals, etc.

L5 Mean for RTRA

1. This is the RTRA procedure macro for producing Mean tabulations which include a selected Level 5 statistic. RTRAMeanL5 is a wrapper macro. It calls the macro ProcessRequest which is the processing routine common to all RTRA procedure macros. To generate a mean, call the following RTRA procedure:

%RTRAMeanL5(
InputDataset=,
OutputName=,
ClassVarList=,
AnalysisVarList=,
L5Stat=,
L5Type=,
L5ByVar=,
L5BaseVal=,
UserWeight=);

2. %RTRAMeanL5 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 corresponding to this call to RTRAMeanL5. Tabulated results are assigned an internally generated name rather than the name in this parameter. The post-processing parameters data set defines the correspondence between the internally generated name and the final output file names. Post-processing is then responsible for creating the final output files name.

ClassVarList = identify a maximum of five variables for the dimensions of the mean procedure. Variables in the list can be separated by any number of spaces, asterisks or combination of spaces and asterisks.

AnalysisVarList = identify a maximum of three variables for the mean procedure. These variables must be separated by spaces.

L5Stat = identifies the name of the Level 5 statistic. Valid values are LC, PC and ST (case insensitive).

L5Type = identifies the Level 5 statistic type. Valid values are SEQUENTIAL, BASE and GLOBAL (case insensitive).

L5ByVar = identifies the Level 5 BY variable. The specified variable must exist in <classVarList>.

L5BaseVal =identifies the Level 5 base value. This parameter is only applicable if <L5Type> is BASE and must be blank if <L5Type> is SEQUENTIAL or GLOBAL. If applicable, the specified value must exist in the variable <L5ByVar> in the input data set.

UserWeight = the survey weight variable (and bootstrap weight variables if they exist) is located in a weights data set in the RTRA data library. The name of the weights data set is the same as the name of the survey weight variable that it contains.

3. Example: This procedure can be used to calculate average dwelling types. Suppose you ran the following RTRA procedure to calculate the mean of a variable called "NUM_DWELCODE" for a table named "Table2". You would like to calculate this average for different education levels and by province using variables called "Education" and "Province".

%RTRAMeanL5(
InputDataset=work.LFS,
OutputName=Table2,
ClassVarList=Education Province,
AnalysisVarList=NUM_DWELCODE,
L5Stat=LC,
L5Type=global,
L5ByVar=education,
L5BaseVal=,
UserWeight=FINALWT);

The following table displays results from the Level 5 Mean 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.

Table 2
Results from example procedure
Education Province NUM_DWELCODE Mean NUM_DWELCODE _MEAN_LCG NUM_DWELCODE Count
College Manitoba 1.82 -0.084 3319000
High School Manitoba 1.94 0.042 3699000
University Manitoba 1.93 0.035 2531500
College Ontario 2.1 -0.099 40139250
High School Ontario 2.2 0.044 38821750
University Ontario 2.3 0.164 35991000

L5SOT Mean for RTRA

1. This is the RTRA procedure macro for producing Mean tabulations which include a selected Level 5 Sequential Over Time (L5SOT) statistic. RTRAMeanL5SOT is a wrapper macro. It calls the macro ProcessRequest which is the processing routine common to all RTRA procedure macros. To generate a mean, call the following RTRA procedure:

%RTRAMeanL5SOT(
InputDataset=,
OutputName=,
ClassVarList=,
AnalysisVarList=,
L5Stat=,
L5YrVar=,
L5MonVar=,
L5QtrVar=,
UserWeight=);

2. %RTRAMeanL5SOT 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 corresponding to this call to RTRAMeanL5SOT. Tabulated results are assigned an internally generated name rather than the name in this parameter. The post-processing parameters data set defines the correspondence between the internally generated name and the final output file names. Post-processing is then responsible for creating the final output files name.

ClassVarList = identify a maximum of five variables for the dimensions of the mean 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.

AnalysisVarList = identify a maximum of three variables for the mean procedure. These variables must be of type numeric. A maximum of three variables can be specified and must be separated by spaces.

L5Stat = identifies the name of the Level 5 statistic. Valid values are LC, PC and ST (case insensitive).

L5YrVar= identifies the Level 5 year variable. If the L5MonVar or L5QtrVar are not used, this field should reference a variable that contains multiple years to demonstrate the "Sequential Over Time" factor.

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 calculate average dwelling types. Suppose you ran the following RTRA procedure to calculate the mean of a variable called "NUM_DWELCODE" for a table named "Table3". You would like to calculate this average for different education levels and by province using variables called "Education" and "Province".

%RTRAMeanL5SOT(
InputDataset=work.LFS,
OutputName=Table3,
ClassVarList=Education Province,
AnalysisVarList=NUM_DWELCODE,
L5Stat=LC,
L5YrVar=NUM_SYEAR,
L5MonVar=NUM_SMTH,
L5TimeInt=2,
UserWeight=FINALWT);

The following table displays results from the example procedure above. In particular we are able to determine the "Sequential Over Time" Mean change between months based on various Education levels. 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 pull results for University responses.

Table 3
Results from example procedure
NUM_SYEAR NUM_SMTH Education NUM_DWELCODE Mean NUM_DWELCODE _MEAN_LCS NUM_DWELCODE Count
2015 January University 2.4   6717000
  February University 2.4   6725500
  March University 2.4 0.032 6731750
  April University 2.4 0.0132 6770750
  May University 2.4 -0.021 6796750
  June University 2.4 -0.027 6905750
Date modified: