C:\to_server\website\mrdcl-learning.com\mrdcl_files\INT-03\getstarted2.stp
start data,
serial number in columns 1-4,
card characters 1000,
ds $q1=$5/1,2,e,
x='Yes;
No;
Not stated<z>',
xt='Q1 Have you used MRDCL before?',
!
!The only change to this variable from getstarted1.stp is that $q1 now has e, on the end of the variable
!This means that you want to add an extra bit that catches anyone who has an error.
!This means that anyone who does not give a code 1 or 2 goes into the error bit. It also means that if someone
!wrongly has both codes 1 and 2, they also go into the error bit. The way that MRDCL works is that in a single
!response variable that the program will take the first answer it finds unless there is an error bit. Therefore, if
!someone answered Yes and No and there was no error bit, the Yes will be taken as this precedes the No answer.
!
!An alternative e, is r, which means reject. This will merely catch anyone who has no value for the variable and
!leaves any multiple answers to the first code encountered. For a multiple response variable e and r have no
!difference. The label not stated has a LABEL CONTROL <z>. There are many label controls which you may wish to
!explore. This one tells MRDCL to suppress the row/column it is zero. It is generally not desirable to see
!not stated rows that are blank. If you want ALL rows to be suppressed if they are blank a format option BRS allows
!you to do this. Likewise if you want all blank columns to be supressed format option BCS does this. See below
!about format options
!
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',
!
!In a multi-variable, $6-8 is the same as explicitly picking up code 1 from each field - i.e. $6/1,$7/1,$8/1,
!An e, has been added to the end of this variable too
!
f=ifbu,
!
di $iq3=$9-10,
xt='Q3 Number of children in family',
!
!The set up file now has an integer defined. Before the integer is the first use of a MRDCL format option.
!Most format options control table layout, but this option controls has data is read. The format option ifb controls
!how blank fields are read. By default a blank is read as zero. This setting sets a blank fields to undefined. Undefined
!is a special value to MRDCL which is rather like .NULL. in spreadsheets and databases. It means that the value will
!not counted in calculations such as statistics etc. The variable is reading a 2 digit field that starts on column
!9 and ends on 10. The $ sign is essential, otherwise it would read the value as 9 minus 10, which would give minus 1.
!A title may be specified with the integer, although you cannot specify bit labels as an integer does not have bits
!
ds $q3=$iq3/0,1..2,3,>3,e,
x='No children;
1/2 children;
3 children;
More than 3 children;
Not stated<z>',
xt='Q3 Number of children in family',
!
!The above defines a variable called $q3. Rather than reading from data columns, it is reading from variable $iq3. You
!are allowed to say ds $q3=$9-10/0,1,2,3,>3,e,. The downside of this is that you do not then have a variable which
!contains the actual value for calculating mean scores etc.
!
!Other than that, it is a normal MRDCL variable.
!
finish data,
start tables,
!
%jh='<jc>My project',
global bt#='All respondents',
f=sdv/spl180/uch/caz'0',
!
!Above are some standard specifications that many users put at the top of a tables stage. %jh is part of a group of
!SPECIAL LABELS that control job headers and the text used for outputs such as mean score, standard deviation etc.
!You could replace the text mean score that comes out for mean with the text average saying %avg='Average',.
!
!global bt# etc specifies the base label that you want by default. As most tables are usually based on all respondents
!this saves you specifying a base title for each table. The third table has a base, so a LOCAL base title is specified
!which replaces the GLOBAL setting
!
!f=sdv/spl180/uch introduces you to format settings. There are 3 types of format settings. These are numeric formats,
!logical formats and character formats. All formats have default settings. There are about 200 formats in MRDCL, most
!of which you will never reset.
!
!Numeric formats take a value. Spl180 is such an example. It means that the number of characters (or spaces) per line
!is 180. You tables will allow 180 characters across before a new page is thrown. MRDCL will automatically throw new pages
!for you.
!Logical formats are true or false. sdv means set showing a standard deviation (where appropriate to true). To unset it,
!you say f=nsdv,. Uch is also a logical format that automatically underlines Column Headings.
!Character formats take a value that may be any character. There are only a small nunber in MRDCL. Caz'0' means set
!the character that displays for zero to be 0. The default in MRDCL is a dash (-). Blank is also allowed.
!
t#1=$q1 * $q2,
!
t#2=$q3 * $q1,
+t#2x=@ $iq3 * $q1,
!
!A new table has been added for question 3. The line t#2=$q3 * $q1, is of the same contruction as the previous table
!However, the line +t#2x needs explanation
!
!+t#2x  The + sign means put the table immediately under the previous table with throwing a new page or new
!  headings.
!@$iq3  This means produce stats only on $iq3. All the statistical options you have set will be shown.
!  The format option above has sdv for standard deviations. Your table will, therefore, show mean scores
!  which are set by default and standard deviations.
!
if $q1/1,t#3=$q3 * $q2,
bt='All who have used MRDCL before',
if $q1/1,+t#3x= @ $iq3 * $q2,
!
! Table 3 is a filtered table on those who said Yes at Q1. The table will require a base title, otherwise it will be
!labelled as All respondents.
!
finish tables,
