socstrat: an interactive guide
The design and method behind a Stata command that builds British social class measures from occupation codes
Oatley, S. (forthcoming) ‘socstrat: an automated command that constructs commonly employed British social stratification measures’, The Stata Journal. Accepted for publication.
Most British surveys record a person’s occupation as a Standard Occupational Classification (SOC) code and ask about their employment status. Turning those two variables into a social class measure means applying a large lookup table, a derivation matrix, by hand. socstrat does that in one line, for two measures (NS-SEC and the Registrar General’s Social Classes, RGSC) and for every SOC version from 1990 to 2020.
Three things to take away
- Full analytic class measures need both occupation and employment status. The same job can sit in different classes.
- One command for every version makes sensitivity analysis cheap: build several measures and compare them.
- Different SOC versions and different measures place some people differently. The paper shows how much.
1The coding problem
An occupation-based class measure is a function of two inputs: a SOC code (hundreds of possible values) and employment status (seven values). The full analytic version of a measure assigns a class to every combination. For NS-SEC on SOC 2020 the paper counts 2,884 combinations to code. Doing that by hand in every project invites typing errors, and different researchers end up with slightly different versions of the “same” measure.
Employment status is coded as in the ONS derivation tables:
| Code | Employment status |
|---|---|
| 1 | Employers – large organisations |
| 2 | Employers – small organisations |
| 3 | Self-employed – no employees |
| 4 | Managers – large organisations |
| 5 | Managers – small organisations |
| 6 | Supervisors |
| 7 | Other employees |
The command holds seven derivation matrices: NS-SEC for SOC 1990, 2000, 2010 and 2020, and RGSC for SOC 1990, 2000 and 2010. RGSC has no SOC 2020 matrix because the measure is no longer maintained.
2Inside a derivation matrix
This widget holds the complete SOC 1990 to NS-SEC matrix exactly as socstrat applies it (370 SOC codes × 7 employment statuses, taken from the command’s source). Enter a three-digit SOC 1990 code to see the class it gives for each employment status.
3Syntax builder
The command takes four required options and one optional one:
socstrat, socstatus(socvar statusvar) generate(newvar) version(90|00|10|20) strat(nssec|rgsc) [nolabel]
Build a call and see what Stata prints. The messages are the command’s own.
4The paper’s examples
The examples use the NCDS occupation coding file (UK Data Service SN 7023), which holds several SOC versions for the same people. That makes it a natural test bed: one dataset, several ways of measuring class. The data need a free UK Data Service registration, so they are not shared here; the example do-file runs once you have them.
Step by step
Check the inputs. describe N5EMPSTA N5SSOC90
Employment status arrives as a one-character string. socstrat needs numbers, so passing it as it is triggers the “missing or not numeric” error from the syntax builder above.
Make status numeric. destring N5EMPSTA, gen(status)
838 people have no employment status and become missing. They will be missing on every class measure.
Build NS-SEC from SOC 1990. socstrat, socstatus(N5SSOC90 status) generate(nssec90) version(90) strat(nssec)
One line replaces the full matrix in section 2. The result is labelled 1.1 to 7.
Build NS-SEC from SOC 2000. destring N5SSOCC, gen(soc2000) force then socstrat ... version(00)
The SOC 2000 codes are stored as text with some non-numeric entries, so force turns those into missing (705 people). The same people now have two NS-SEC measures.
Build RGSC from both versions and cross-tabulate everything.
Four measures from two commands each. Section 5 shows the cross-tabulations.
Example 1 output: NS-SEC from SOC 1990
| NS-SEC class | Freq. | Percent |
|---|
Source: the paper’s Example 1 log (N = 10,624 with valid SOC 1990 code and employment status).
5Comparing versions of the same measure
The point of building several versions is to see whether they agree. The cross-tabulations below are from the paper. Cells on the diagonal are people placed in the same class by both versions.
The paper also cross-tabulates NS-SEC against RGSC from the same SOC version. There the spread is far larger than between two versions of one measure: the two schemas draw class boundaries in different places. That is the case for sensitivity analysis: the choice of measure matters more than the choice of SOC version.
6Design decisions
Full analytic measures only.
An earlier Stata command for NS-SEC, soc2nssec, produces only the “simplified” measure from occupation alone. socstrat always uses employment status, because section 2 shows that the same occupation can belong to different classes.
Impossible combinations stay missing (RGSC, SOC 1990).
Some occupation and status pairs cannot exist, such as a chief executive recorded as an “other employee”. The RGSC SOC 1990 matrix codes these as missing rather than guessing. This is why RGSC and NS-SEC from the same SOC version can have different numbers of observations.
No RGSC for SOC 2020.
RGSC is a historical measure with no official SOC 2020 derivation. The command stops with an error rather than inventing one.
Input checks before any recoding.
The command checks that both variables are numeric, that status is 1 to 7, and that every SOC code falls in the range of the version requested. If any check fails, nothing is created.
Labels on by default; nolabel for collapsing.
The new variable is always coded 1, 2, 3 and so on, with labels attached unless you add nolabel. To collapse NS-SEC to its five-class version:
recode nssec90 (1 2 3 = 1) (4 = 2) (5 = 3) (6 = 4) (7 8 = 5), generate(nssec90_5)
What is left out, and why.
CAMSIS measures social distance rather than class, so it would sit better in its own command. Capitals, assets and resources (CAR) measures are inductive: they are estimated from each sample, so a fixed lookup table cannot produce them.
7Check yourself
8Code and reading
- Example do-file from the paper. Set the two folder paths at the top.
- Install:
ssc install socstrat. Source: github.com/Scott0atley/socstrat - Example data: UK Data Service SN 7023
- Related: Measuring social class: an interactive guide