C:\to_server\website\mrdcl-learning.com\mrdcl_files\DAT-04\run1a.stp
start data,
serial number in columns 1,2,3,
card characters binary 30000,
read $1-30000,
!
ds $age=$5/1-3,e,
v='Age\16-35 years old;
36-54 years old _this_ is a very long line now;
55+ years old;
Not stated',
h='Age\16-35;
36-54;
55+;
Not stated',
xt='Age',
di $iage=$6-7,
xt='Actual age',
!
ds $age2=$6-7/<16,16..34,35..54,>54,e,
x='Less than 16<v12>;
16 - 34<v25>;
35 - 54<v45>;
55+<v80>;
Not stated',
xt=$iage,
!
ds $age3=$iage/<16,16..40,>40,e,
x='Under 16;
16 - 40;
Over 40;
Not stated',
xt='Age with different groupings',
!
ds $brand1=$8/1-5,e,
x='Brand 1;
Brand 2;
Brand 3;
Brand 4;
Brand 5;
Not stated',
xt='Favourite brand',
ds $brand2=$9/1-5,e,
!!!x=$brand1,
x='Brand 1;
Brand 2;
Brand 3;
Brand 4;
Brand 5;
Not stated',
xt='Second favourite brand',
!
dm $myvar=$8/1+2+5,3.4,n1,n1..3,
x='Brand 1 or 2 or 5;
Brand 3 AND Brand 4;
NOT Brand 1;
NOT ANY of Brands 1, 2, 3',
xt='Myvar',
!
!Variable illustrating how to change columns/variables within a definition
dm $xmyvar2=$8/1,$8/2,$brand2/4,5,$9/1,2..3,1.$brand1/4,
!These two lines mean the same thing
dm $myvar2=$8/(1+3).$9/(1+3),
dm $myvar2=($8/1+3).($9/1+3),
x='Brand (1 or 3) 8 AND Brand (1 or 3) at 9',
xt='My variable',
!This illustrates variables constructions using .or., .and., .eor. and .not.
dm $mbrands=$brand1.or.$brand2,
dm $mbrands=$mbrands/1-5,e,
!This is the same as saying $brand1/1+$brand2/1, $brand1/2+$brand2/2, $brand1/3+$brand2/3 etc
xt='First/second favourite brands',
x='Brand 1;
Brand 2;
Brand 3;
Brand 4;
Brand 5;
Not stated',
!
if $iage/<50,dm $xmm1=t,$brand1,
if $iage/>49,dm $xmm2=t,$brand2,
dm $mm=$xmm1,$xmm2,
x='
Under 50s<b>;
Under 50s favourite brand\
Brand 1;
Brand 2;
Brand 3;
Brand 4;
Brand 5;
NS;
Over 50s<b>;
Over 50s second favourite brand\
Brand 1;
Brand 2;
Brand 3;
Brand 4;
Brand 5;
NS',
xt='A variable',
list csv 'Age'.$iobs.$6-7,
list csv 'brand1'.$iobs.&$brand1,
di $howmany=$10-11,
ds $howoften=$12/1-5,
xt='How many owned',
x='Every day;
3-4 times a week;
1-2 times a week;
Less than once a week;
Never',
xt='How often each one used',
dw $value=$howoften(7,3.5,1.5,0.5,0),
xt='Value',
dw $total=$howmany * $value,
xt='Total',
list csv 'Total'.$iobs.$howmany.$value.$total,
!
!Making a banner
!
dm $banner=$age/1..2,3,$brand1/1..2,3..4,5,$brand2/1..2,3..4,5,
h='Age\
16-44;
45+;
Favourite brand\
Brands 1/2;
Brands 3/4;
Brand 5;
Second favourite brand\
Brands 1/2;
Brands 3/4;
Brand 5 and more text<t=clw10>',
!
dm $bannera=$age/1..2,3,
h='Age\16-44;45+',
dm $bannerb=$age/1,2..3,
h='Age\16-34;35+',
dm $bannerc=$brand1/1..3,4..5,
h='Fav. brand\Brands 1-3;Brands 4-5',
dm $bannerd=$brand2/1..3,4..5,
h='Second fav. brand\Brands 1-3;Brands 4-5',
finish data,
start tables,
select banner $banner,
f=clw6/rlw30/bal/urh/uch/spl130/rth/brs/caz'0'/evr/sdv,
%jh='MY PROJECT TITLE<jc>',
%jf='MY FOOTNOTE<jc>',
t#1=$age *,
%avg='Mid-point mean',
t#2=$age2 *,
%avg='Mean',
+t#2a=$iage *,
t#2b(f=rna/med/mod/ill/ilh)=$iage(100) *,
t#3=$myvar *,
t#4=$brand1 *,
t#5=$brand1 * $brand2,
t#6(f=nbrs)=$brand2 *,
t#7=$mbrands *,
if $iage/<50,t#8=$brand1 *,
bt='All aged under 50',
t#9=$mm *,
dm $banner1=$bannera,$bannerc,
h=$bannera + $bannerc,
t#10=$age * $banner1,
dm $banner2=$bannerb,$bannerc,$bannerd,
h=$bannerb+$bannerc+$bannerd,
t#11=$age2 * $banner2,
dm $banner3=$bannerb,$bannerd,$iage/<50,>50,
h=$bannerb + $bannerd + 'Age\Under 50;Over 50',
t#12=$brand2 * $banner3,
finish tables,
