C:\to_server\website\mrdcl-learning.com\mrdcl_files\DAT-101\run11.stp
start data,
serial number in columns 1,2,3,
card numbers /1/,/2/,/99/,
dm $allcards(2),
@readcard,
read $9901-9980 erec=done,
dm $thiscard=$9904/1-2,
dm $dupcard=$allcards.and.$thiscard,
if $dupcard/1,list 'Duplicate card'.$9904,
dm $allcards=$allcards.or.$thiscard,
if $thiscard/m+b,list 'Invalid card number'.$9904,
if $9904/1,then,d$101-180=$9901-9980,go to hhold,endif,
if $9904/2,then,d$201-280=$9901-9980,go to indiv,endif,
list 'Invalid card found'.$9904,
go to readcard,
>>  Warning at line 19 in C:\to_server\website\mrdcl-learning.com\mrdcl_files\DAT-101\run11.stp
>>  Last few chars parsed were {endif,list'Invalid card found'.$9904,gotoreadcard,}
>>W 329 Backward jump
@hhold,
di $itotcinema=0,
dm $allfavfilm(3),
ds $sec=$105/1,2,
x='A;B',
xt='SEC',
ds $region=$106/1-3,
x='North;
Central;
South',
xt='Region',
go to readcard,
>>  Warning at line 34 in C:\to_server\website\mrdcl-learning.com\mrdcl_files\DAT-101\run11.stp
>>  Last few chars parsed were {='North; Central; South',xt='Region',gotoreadcard,}
>>W 329 Backward jump
@indiv,
zero to finish,
ds $gender=$205/1,2,
x='Male;
Female',
xt='Gender',
di $icinema=$206-207,
xt='Number of times been to cinema',
!
di $itotcinema=$itotcinema + $icinema,
xt='Total visits by family to cinema',
ds $cinema=$icinema/0,1,2,3..5,6..10,>10,
x='None;
Once;
Twice;
3 - 5 times;
6 - 10 times;
More than 10 times',
xt=$icinema,
ds $favfilm=$208/1-3,
x='Comedy;
Romantic;
Other',
xt='Favourite film type',
!
ordm $allfavfilm=$favfilm,
x=$favfilm,
xt='Total favourite film types',
ds $level=f,t,
x='Household;Individual',
xt='Level',
write,
go to readcard,
>>  Warning at line 73 in C:\to_server\website\mrdcl-learning.com\mrdcl_files\DAT-101\run11.stp
>>  Last few chars parsed were {usehold;Individual',xt='Level',write,gotoreadcard,}
>>W 329 Backward jump
@done,
ds $totcinema=$itotcinema/0-20,>20,
x='
0 visits;
1 visits;
2 visits;
3 visits;
4 visits;
5 visits;
6 visits;
7 visits;
8 visits;
9 visits;
10 visits;
11 visits;
12 visits;
13 visits;
14 visits;
15 visits;
16 visits;
17 visits;
18 visits;
19 visits;
20 visits;
More than 20',
xt='Total visits to cinema',
if $allcards/n1,list 'There is no card 1',
ds $level=t,f,
write,
finish data,
start tables,
t#0=$level *,
ul $level/1, go to indivs,
global bt#='All households',
t#1=$sec *,
t#2=$region *,
t#3(f=brs)=$totcinema *,
t#4=$allfavfilm *,
@indivs,
ul $level/2, go to doneinds,
global bt#='All individuals',
t#5=$gender *,
t#6=$cinema *,
t#6a(f=rna)=$icinema(100) *,
t#7=$favfilm *,
@doneinds,
finish tables,
