G:\Shared drives\MRDC Documents\Website\mrdcl-learning.com\mrdcl_files\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',
!
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',
!
!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',
!
!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 *,
select banner $q2,
!
t#33=$q1 *,
!
t#34=$q2 *,
!
t#35=$q4 *,
!
t#36=$q5a *,
t#37=$q5b *,
t#38=$q5c *,
t#39=$q5d *,
t#40=$q5e *,
t#41=$q5f *,
t#42=$q5g *,
t#43=$q5h *,
t#44=$q5i *,
t#45=$q5j *,
t#46=$q5k *,
t#47=$q5l *,
!
t#48=$q6a *,
t#49=$q6b *,
t#50=$q6c *,
t#51=$q6d *,
t#52=$q6e *,
!
t#53=$q7a *,
t#55=$q7b *,
t#57=$q7c *,
t#59=$q7d *,
select banner $q3,
!
t#61=$q1 *,
!
t#62=$q2 *,
!
t#63=$q4 *,
!
t#64=$q5a *,
t#65=$q5b *,
t#66=$q5c *,
t#67=$q5d *,
t#68=$q5e *,
t#69=$q5f *,
t#70=$q5g *,
t#71=$q5h *,
t#72=$q5i *,
t#73=$q5j *,
t#74=$q5k *,
t#75=$q5l *,
!
t#76=$q6a *,
t#77=$q6b *,
t#78=$q6c *,
t#79=$q6d *,
t#80=$q6e *,
!
t#81=$q7a *,
t#83=$q7b *,
t#85=$q7c *,
t#87=$q7d *,
select banner $q4,
!
t#89=$q1 *,
!
t#90=$q2 *,
!
t#91=$q4 *,
!
t#92=$q5a *,
t#93=$q5b *,
t#94=$q5c *,
t#95=$q5d *,
t#96=$q5e *,
t#97=$q5f *,
t#98=$q5g *,
t#99=$q5h *,
t#100=$q5i *,
t#101=$q5j *,
t#102=$q5k *,
t#103=$q5l *,
!
t#104=$q6a *,
t#105=$q6b *,
t#106=$q6c *,
t#107=$q6d *,
t#108=$q6e *,
!
t#109=$q7a *,
t#111=$q7b *,
t#113=$q7c *,
t#115=$q7d *,
!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.
!
finish tables,
