DATA LIST
DATA LIST LIST /recID (F5.0) country (A20) pop (F9.0) rank (F1.0) segment (F1.0).
Reading free-form data from INLINE.
Variable |
Format |
recID |
F5.0 |
country |
A20 |
pop |
F9.0 |
rank |
F1.0 |
segment |
F1.0 |
BEGIN DATA
BEGIN DATA
1 Germany 81 1 1
2 Netherlands 17 4 2
3 Italy 61 3 2
4 France 66 2 1
END DATA.
COMPUTE
COMPUTE everybody = 1.
AUTORECODE
AUTORECODE VARIABLES = country INTO nation.
DATASET COPY
DATASET COPY AGGSUB_WORK.
DATASET DECLARE
DATASET DECLARE AGG_1.
DATASET ACTIVATE
DATASET ACTIVATE AGGSUB_WORK.
AGGREGATE
AGGREGATE OUTFILE=AGG_1 /BREAK = everybody segment
/pop rank= MEAN(pop rank)
/N_pop = N(pop)
/N_rank = N(rank)
/NU_pop = NU(pop)
/NU_rank = NU(rank)
.
DATASET DECLARE
DATASET DECLARE AGG_2.
DATASET ACTIVATE
DATASET ACTIVATE AGGSUB_WORK.
AGGREGATE
AGGREGATE OUTFILE=AGG_2 /BREAK = everybody nation
/pop rank= MEAN(pop rank)
/N_pop = N(pop)
/N_rank = N(rank)
/NU_pop = NU(pop)
/NU_rank = NU(rank)
.
DATASET ACTIVATE
DATASET ACTIVATE AGG_1.
ADD FILES
ADD FILES FILE=* /FILE=AGG_2.
DATASET CLOSE
DATASET CLOSE AGG_2.
.
MATCH FILES
MATCH FILES FILE=* /KEEP=everybody segment nation pop rank ALL.
SELECT IF
SELECT IF NOT MISSING(segment)
OR NOT MISSING(nation)
.
SORT CASES
SORT CASES BY everybody segment nation.
APPLY DICTIONARY