Z:\to_server\website\mrdcl-learning.com\mrdcl_files\MKT-01\INT-07\getstarted6.stp
start data,
serial number in columns 1-4,
card characters 1000,
!
!This .stp goes back to getstarted4.stp
!
ds $q1=$5/1,2,e,
v='Yes;
No;
Not stated<z>',
h='Ever used MRDCL\
Yes;
No;
NS<s>',
xt='Q1 Have you used MRDCL before?',
!
dm $q2=$6-8,e,
x='Ate at a restaurant;
Went to see a film;
Went to watch a sporting event;
None/NS',
xt='Q2 Activities in the past month',
!this is a comment
f=ifbu,
!
di $iq3=$9-10,
xt='Q3 Number of children in family',
!
ds $q3=$iq3/0,1,2,3,>3,e,
x='No children;
1 child;
2 children;
3 children;
More than 3 children;
Not stated<z>',
xt='Q3 Number of children in family',
!
dm $q4=$12/1..2,4+5,1-5,e,
x='Top 2 box;
Bottom 2 box;
Very good (5)<v5>;
Quite good (4)<v4>;
Average (3)<v3>;
Quite poor (2)<v2>;
Very poor (1)<v1>;
Not stated<z>',
xt='Q4 Rating of postal service',
!
!This tutorial shows how to use the basics of the highly powerful PREPROCESSOR with MRDCL. The example here only
!introduces you to the preprocessor.
!
dm $q5a=$13/1..2,1-5,e,
x='Top 2 box;
Very good (5)<v5>;
Quite good (4)<v4>;
Average (3)<v3>;
Quite poor (2)<v2>;
Very poor (1)<v1>;
Not stated<z>',
xt='Q5 Rating of brands - Amberside',
dm $q5b=$14/1..2,1-5,e,
x='Top 2 box;
Very good (5)<v5>;
Quite good (4)<v4>;
Average (3)<v3>;
Quite poor (2)<v2>;
Very poor (1)<v1>;
Not stated<z>',
xt='Q5 Rating of brands - Bucknall',
dm $q5c=$15/1..2,1-5,e,
x='Top 2 box;
Very good (5)<v5>;
Quite good (4)<v4>;
Average (3)<v3>;
Quite poor (2)<v2>;
Very poor (1)<v1>;
Not stated<z>',
xt='Q5 Rating of brands - Caledonian',
dm $q5d=$16/1..2,1-5,e,
x='Top 2 box;
Very good (5)<v5>;
Quite good (4)<v4>;
Average (3)<v3>;
Quite poor (2)<v2>;
Very poor (1)<v1>;
Not stated<z>',
xt='Q5 Rating of brands - Derwent',
dm $q5e=$17/1..2,1-5,e,
x='Top 2 box;
Very good (5)<v5>;
Quite good (4)<v4>;
Average (3)<v3>;
Quite poor (2)<v2>;
Very poor (1)<v1>;
Not stated<z>',
xt='Q5 Rating of brands - Eggsceptional',
dm $q5f=$18/1..2,1-5,e,
x='Top 2 box;
Very good (5)<v5>;
Quite good (4)<v4>;
Average (3)<v3>;
Quite poor (2)<v2>;
Very poor (1)<v1>;
Not stated<z>',
xt='Q5 Rating of brands - Forster',
dm $q5g=$19/1..2,1-5,e,
x='Top 2 box;
Very good (5)<v5>;
Quite good (4)<v4>;
Average (3)<v3>;
Quite poor (2)<v2>;
Very poor (1)<v1>;
Not stated<z>',
xt='Q5 Rating of brands - Georgio',
dm $q5h=$20/1..2,1-5,e,
x='Top 2 box;
Very good (5)<v5>;
Quite good (4)<v4>;
Average (3)<v3>;
Quite poor (2)<v2>;
Very poor (1)<v1>;
Not stated<z>',
xt='Q5 Rating of brands - Harrisons',
dm $q5i=$21/1..2,1-5,e,
x='Top 2 box;
Very good (5)<v5>;
Quite good (4)<v4>;
Average (3)<v3>;
Quite poor (2)<v2>;
Very poor (1)<v1>;
Not stated<z>',
xt='Q5 Rating of brands - Irkutsk',
dm $q5j=$22/1..2,1-5,e,
x='Top 2 box;
Very good (5)<v5>;
Quite good (4)<v4>;
Average (3)<v3>;
Quite poor (2)<v2>;
Very poor (1)<v1>;
Not stated<z>',
xt='Q5 Rating of brands - Juniper',
dm $q5k=$23/1..2,1-5,e,
x='Top 2 box;
Very good (5)<v5>;
Quite good (4)<v4>;
Average (3)<v3>;
Quite poor (2)<v2>;
Very poor (1)<v1>;
Not stated<z>',
xt='Q5 Rating of brands - King',
dm $q5l=$24/1..2,1-5,e,
x='Top 2 box;
Very good (5)<v5>;
Quite good (4)<v4>;
Average (3)<v3>;
Quite poor (2)<v2>;
Very poor (1)<v1>;
Not stated<z>',
xt='Q5 Rating of brands - Leonard',
dm $q5m=$25/1..2,1-5,e,
x='Top 2 box;
Very good (5)<v5>;
Quite good (4)<v4>;
Average (3)<v3>;
Quite poor (2)<v2>;
Very poor (1)<v1>;
Not stated<z>',
xt='Q5 Rating of brands - My extra one',
dm $q5n=$26/1..2,1-5,e,
x='Top 2 box;
Very good (5)<v5>;
Quite good (4)<v4>;
Average (3)<v3>;
Quite poor (2)<v2>;
Very poor (1)<v1>;
Not stated<z>',
xt='Q5 Rating of brands - NEW ONE',
dm $q5o=$27/1..2,1-5,e,
x='Top 2 box;
Very good (5)<v5>;
Quite good (4)<v4>;
Average (3)<v3>;
Quite poor (2)<v2>;
Very poor (1)<v1>;
Not stated<z>',
xt='Q5 Rating of brands - OOOOOOOOOOO',
dm $q5p=$28/1..2,1-5,e,
x='Top 2 box;
Very good (5)<v5>;
Quite good (4)<v4>;
Average (3)<v3>;
Quite poor (2)<v2>;
Very poor (1)<v1>;
Not stated<z>',
xt='Q5 Rating of brands - phil',
!
!This is MRDCL preprocessor code. Data 15 contains a list of texts that we want to use for titles of each of
!12 rating scales. Each text in data 15 is separated by a comma. If you need a comma in one or more of the texts,
!you can use a different character such as # to delimit them. *data 16 illustrates this below.
!
! This *do a line tells MRDCL that you want to loop round 12 times (for the 12 rating scales)
! Rather than using copy and paste to define these 12 variables, the preprocessor
! will do the work for you. In our view, you should never use copy and paste!
! The preprocessor will loop 12 times starting at 1 and increment a to a value of 12.
! ~a means give the letter in the alphabet of the value of a. This means first time
! round the loop a will be substituted, b the second and so on up to j. If the loop
! is greater than 26, it will go on to aa, ab etc thru to zz, then aaa, aab etc.
! a+12 means substitute 13 the first time, 14 the next up to 24.
!The x labels are standard MRDCL code, but the title uses substitution. 15.a means substitute that element of
!data statement 15. This means that for variable $q5a the label Amberside will be substituted etc to Juniper for the
!tenth variable. The listing file shows the fully expanded code, which, of course, you could have keyed in.
!
!
ds $q6a=$25/1-5,e,
x='Very good (5)<v5>;
Quite good (4)<v4>;
Average (3)<v3>;
Quite poor (2)<v2>;
Very poor (1)<v1>;
Not stated<z>',
xt='Q6 Rating of brands - Arnfield',
ds $q6b=$27/1-5,e,
x='Very good (5)<v5>;
Quite good (4)<v4>;
Average (3)<v3>;
Quite poor (2)<v2>;
Very poor (1)<v1>;
Not stated<z>',
xt='Q6 Rating of brands - Baker',
ds $q6c=$29/1-5,e,
x='Very good (5)<v5>;
Quite good (4)<v4>;
Average (3)<v3>;
Quite poor (2)<v2>;
Very poor (1)<v1>;
Not stated<z>',
xt='Q6 Rating of brands - Chisholm',
ds $q6d=$31/1-5,e,
x='Very good (5)<v5>;
Quite good (4)<v4>;
Average (3)<v3>;
Quite poor (2)<v2>;
Very poor (1)<v1>;
Not stated<z>',
xt='Q6 Rating of brands - Davidson',
ds $q6e=$33/1-5,e,
x='Very good (5)<v5>;
Quite good (4)<v4>;
Average (3)<v3>;
Quite poor (2)<v2>;
Very poor (1)<v1>;
Not stated<z>',
xt='Q6 Rating of brands - Enderby',
!
!The above example shows how to deal with loops when you want to step two values differently. Outside of the loop,
!an index called 'loopcount' is set to a value of 1. You will note that loopcount is stepped up by 1 just before the end a
!command. The *do loop, however, now has :2 on the end which means step up in steps of 2, i.e. taking values 25,
!27, 29, 31 and 33. This will give you 5 variables called q6a to q6e.
!The list file again shows the full code.
!
ds $q7a=$24/1-5,e,
x='Very good (5)<v5>;
Quite good (4)<v4>;
Average (3)<v3>;
Quite poor (2)<v2>;
Very poor (1)<v1>;
Not stated<z>',
xt='Q7 Rating of brands - Rating A',
ds $q7b=$26/1-5,e,
x='Very good (5)<v5>;
Quite good (4)<v4>;
Average (3)<v3>;
Quite poor (2)<v2>;
Very poor (1)<v1>;
Not stated<z>',
xt='Q7 Rating of brands - Rating B',
ds $q7c=$28/1-5,e,
x='Very good (5)<v5>;
Quite good (4)<v4>;
Average (3)<v3>;
Quite poor (2)<v2>;
Very poor (1)<v1>;
Not stated<z>',
xt='Q7 Rating of brands - Rating C',
ds $q7d=$31/1-5,e,
x='Very good (5)<v5>;
Quite good (4)<v4>;
Average (3)<v3>;
Quite poor (2)<v2>;
Very poor (1)<v1>;
Not stated<z>',
xt='Q7 Rating of brands - New entry',
ds $q7e=$44/1-5,e,
x='Very good (5)<v5>;
Quite good (4)<v4>;
Average (3)<v3>;
Quite poor (2)<v2>;
Very poor (1)<v1>;
Not stated<z>',
xt='Q7 Rating of brands - Metrixlab',
ds $q7f=$50/1-5,e,
x='Very good (5)<v5>;
Quite good (4)<v4>;
Average (3)<v3>;
Quite poor (2)<v2>;
Very poor (1)<v1>;
Not stated<z>',
xt='Q7 Rating of brands - Phil',
!
!The above illustrates how to use a csv file as input to MRDCL. CSV files work like data statements but allow
!you to feed MRDCL via an external file. This is extremely useful for continuous projects where you want to
!control processing by editing a small number of key files rather than tampering with MRDCL script.
!*data 20 reads the csv file.
!set n=20.# counts the number of items in the CSV file. This means that if the size of the CSV file changes
!the program loop more times. This can be very useful for controlling processing.
!After that it works just like a data statement.
!You may want to look at even more powerful features that exist when you use Excel workbooks or Access tables
!rather than CSV files. A separate tutorial is available for this
!
!Also in the preprocessor, you can use insert files to include code from another .stp file. This can be a very
!powerful feature as you can set parameters that have some effect on the inserted code. A separate tutorial is
!available on this.
dm $mybanner=$q1,$q2/1-3,$q4/1..2,3,4..5,
h=$q1 +
'Activities in past month\
Rest- au- rant;
Saw film;
Spor*ting event;
Postal service\
Good;
Aver- age;
Poor',
!
dm $bannersig=$q2/1-3,$q4/1..2,3,4..5,
h='Activities in past month\
Rest- au- rant (a);
Saw film (b);
Spor*ting event (c);
Postal service\
Good (d);
Aver- age (e);
Poor (f)',
finish data,
start tables,
!
%jh='<jc>My project',
%jf='Prepared by a really good MRDCL specwriter on <&dd> <&month> <&year><jc>',
global bt#='All respondents',
f=sdv/spl180/uch/caz'0',
f=shg1/sla90/slb95/sig1/mct50,
f=med/mod/ilh,
t#999(f=rna/ndis)=$iq3(100) *,
!
!select banner $mybanner,
!
t#1=$q1 * $q2,
!
t#2=$q3 * $q1,
+t#2x=@ $iq3 * $q1,
%avg='Mean excl 0<d2>',
if $iq3/n0,+t#2y=@ $iq3 * $q1,
%avg='Mean score',
!
if $q1/1,t#3=$q3 * $q2,
bt='All who have used MRDCL before',
if $q1/1,+t#3x= @ $q3 * $q2,
!
t#4(f=evr/ser)=$q4 * $q1,
select banner $q1,
!
t#5=$q1 *,
!
t#6=$q2 *,
!
t#7=$q4 *,
!
t#8=$q5a *,
t#9=$q5b *,
t#10=$q5c *,
t#11=$q5d *,
t#12=$q5e *,
t#13=$q5f *,
t#14=$q5g *,
t#15=$q5h *,
t#16=$q5i *,
t#17=$q5j *,
t#18=$q5k *,
t#19=$q5l *,
!
t#20=$q6a *,
t#21=$q6b *,
t#22=$q6c *,
t#23=$q6d *,
t#24=$q6e *,
!
t#25=$q7a *,
t#27=$q7b *,
t#29=$q7c *,
t#31=$q7d *,
t#33=$q7e *,
t#35=$q7f *,
select banner $q2,
!
t#37=$q1 *,
!
t#38=$q2 *,
!
t#39=$q4 *,
!
t#40=$q5a *,
t#41=$q5b *,
t#42=$q5c *,
t#43=$q5d *,
t#44=$q5e *,
t#45=$q5f *,
t#46=$q5g *,
t#47=$q5h *,
t#48=$q5i *,
t#49=$q5j *,
t#50=$q5k *,
t#51=$q5l *,
!
t#52=$q6a *,
t#53=$q6b *,
t#54=$q6c *,
t#55=$q6d *,
t#56=$q6e *,
!
t#57=$q7a *,
t#59=$q7b *,
t#61=$q7c *,
t#63=$q7d *,
t#65=$q7e *,
t#67=$q7f *,
select banner $q3,
!
t#69=$q1 *,
!
t#70=$q2 *,
!
t#71=$q4 *,
!
t#72=$q5a *,
t#73=$q5b *,
t#74=$q5c *,
t#75=$q5d *,
t#76=$q5e *,
t#77=$q5f *,
t#78=$q5g *,
t#79=$q5h *,
t#80=$q5i *,
t#81=$q5j *,
t#82=$q5k *,
t#83=$q5l *,
!
t#84=$q6a *,
t#85=$q6b *,
t#86=$q6c *,
t#87=$q6d *,
t#88=$q6e *,
!
t#89=$q7a *,
t#91=$q7b *,
t#93=$q7c *,
t#95=$q7d *,
t#97=$q7e *,
t#99=$q7f *,
select banner $q4,
!
t#101=$q1 *,
!
t#102=$q2 *,
!
t#103=$q4 *,
!
t#104=$q5a *,
t#105=$q5b *,
t#106=$q5c *,
t#107=$q5d *,
t#108=$q5e *,
t#109=$q5f *,
t#110=$q5g *,
t#111=$q5h *,
t#112=$q5i *,
t#113=$q5j *,
t#114=$q5k *,
t#115=$q5l *,
!
t#116=$q6a *,
t#117=$q6b *,
t#118=$q6c *,
t#119=$q6d *,
t#120=$q6e *,
!
t#121=$q7a *,
t#123=$q7b *,
t#125=$q7c *,
t#127=$q7d *,
t#129=$q7e *,
t#131=$q7f *,
!Note the use of setting an index which has been called t to automatically set the table number
!
!GENERAL ADVICE:
!Errors in the preprocessor can be hard to find occasionally. The log file tells you the row and column of the .stp
!file at which it got lost. Sometimes your error may be caused by, for example, failing to close the previous loop
!so always look back to the previous use of a loop where an error is not apparent.
!
dm $q5dum(16),
h='
Amberside;
Bucknall;
Caledonian;
Derwent;
Eggsceptional;
Forster;
Georgio;
Harrisons;
Irkutsk;
Juniper;
King;
Leonard;
My extra one;
NEW ONE;
OOOOOOOOOOO;
phil
',
t#133(f=nitb/nptc)=$q5a * $q5dum,
vt='Q5 Summary',
t#133=$q5a * 1,
t#133=$q5b * 2,
t#133=$q5c * 3,
t#133=$q5d * 4,
t#133=$q5e * 5,
t#133=$q5f * 6,
t#133=$q5g * 7,
t#133=$q5h * 8,
t#133=$q5i * 9,
t#133=$q5j * 10,
t#133=$q5k * 11,
t#133=$q5l * 12,
t#133=$q5m * 13,
t#133=$q5n * 14,
t#133=$q5o * 15,
t#133=$q5p * 16,
finish tables,
