Z:\to_server\website\mrdcl-learning.com\mrdcl_files\INT-02\getstarted1.stp
start data,
serial number in columns 1-4,
card characters 1000,
!
!This is a basic MRDCL set up. All lines that begin with an exclamation mark (!) are treated comments
!MRDCL will, therefore, ignore these lines when it runs.
!
!In these Get Started .stp files, you will find that comments usually follow a block of code to describe
!the meaning of the code. MRDCL terms will be show in CAPITALS. You may find these terms to look at in
!more detail when looking at the MRDCL help
!
!The first thing you will notice is that there is a control stage. This is mandatory. Every MRDCL .stp file
!must have a start control and a finish control line. Between these lines you can have RUN CONTROL PARAMETERS (also
!known as RCP's). These RCP's tell MRDCL the name of the data file, output files you want and other controls for the
!the entire run. You will tend to use a small number of these and they will be covered later. In this run, c=gs1.csi,
!tells MRDCL that the data file to use is called gs1.csi. This is a binary file format.
!
!You will note that MRDCL code is free format, so that spaces and line feeds are ignored. The exception to this
!is in text where spaces are not ignored. You should, however, take care to lay out your code so that it is
!easily readable.
!
!After the start control, you will find a start data statement. This tells MRDCL the type of STAGE that you are
!using. There are 4 stages that you can have. These are DATA STAGE, TABLES STAGE, MANIP STAGE and PRINT STAGE.
!
!The data stage is where you read and punch data, define variables, labels, recode data, edit data. You can also specify
!tables in this stage, although it is recommended that you have tables in a separate TABLES STAGE.
!
!The tables stage allows you to define variables from variables already defined in the data stage and prodduce tables.
!You cannot read data from card columns or data fields in this stage, as the tables stage is ready MRDCL's internal
!data files
!
!The manip stage allows you to make calculations on incremented tables. For example you may wish to divide one row
!by another row.
!
!The print stage is used infrequently, but allows you to print selective tables. Its main purpose is for syndicated
!research projects where you wish to print several volumes of tables from a larger set of tables for selected
!customers.
!
!The serial number is not mandatory, but is usually used to tell MRDCL where a unique identifier is stored.
!The card numbers statement is only applicable if you are using 80 column card format. If you are reading a
!long ASCII record, for example, you would not have this statement.
!
!When you have a serial number and card number statement with 80 column card format data, MRDCL will automatically
!read data for you into BUFFERS. Card 1 data will be held in columns 101-180, i.e. column 124 means column 24 of card 1,
!column 234 means column 34 of card 2 etc.
!
ds $q1=$5/1,2,e,
x='Yes;
No;
NS',
!h='Whether used MRDCL\Yes;No',
xt='Q1 Have you used MRDCL before?',
!
!Here is a simple variable definition. Its component parts are broken down below.
!
!ds  This means define a single variable, i.e. only one answer may be given. There a 5 MRDCL VARIABLE TYPES.
!  These are single, multi, integer, weight (real numbers with decimal points) and character.
!  dm, therefore, means define a multiple value variable. di means integer, dw means weight and
!  dc means character.
!
!$q1  This means that the name of the variable you are declaring is called q1. The $ sign is mandatory.
!  Variables names usually begin with a letter and can be up to 8 characters. Variables names are not
!  case sensitive, so $myvar is the same as $MyVar and can be used interchangeably.
!  Variables that begin with the letter x have a special meaning. It means that they are temporary
!  variables that are not written to the INTERMEDIATE DATA FILE (IDF). You cannot use such variables
!  in tables. They can also be used to build complex variables. Variables beginning with X will also not
!  be exported to other programs, such as Triple S, SPSS, Reflect etc.
!
!=  Mandatory!
!
!$5/1,2, This means that you want to create a variable with 2 BITS. The data comes from the fifth column/field of the
!  data picking up code 1 and code 2. You could have entered $5/1,$5/2, but MRDCL
!  assumes the same column automatically.
!
!x=  There are five label types. These a BIT LABELS, TITLES, BASE TITLES, FOOTNOTES and INTERMEDIATE TITLES.
!  It is normal to give each variable a title. Single response and multiple response variables normally have
!  bit labels. Base titles, footnotes and intermediate labels are usually associated with tables, although
!  they can be associated with variables too.
!
!  For a single or multi response variable you can specify separate vertical and horizotal labels. You might,
!  for example, specify longer labels with the variable is used as the rows of a table, but shorter text
!  when it is used horizontally as a banner/break/header. An x= label means that you want to use the same
!  labels regardless of whether it is used as rows or columns.
!
!'Yes;No', Text is always enclosed in single quotes. If you want a single quote to appear your actual text, you
!  will need to use the escape character (`). For example, 'respondent doesn`'t know'. Each label inside
!  the single quote is separated by a semi colon (;). The last label does not need a semi colon after it
!  although ;', without any spaces does not produce an error.
!  A MRDCL is free format, you can have the labels on one label or separated over two labels.
!  MRDCL ignores leading and trailing spaces in labels but not embedded spaces. For example:
!  "Yes    ;     No', would be treated the same as 'Yes;No'. If you wish you can change the DELIMITER
!  for labels from ; to another special character. You may find this useful if you are converting
!  from other programs.
!
!xt='Q1 etc. As with response labels you can choose a different title for when the variable is used as rows or
!  columns. You would need to specify a vt (vertical title) label and a ht (horizontal title) label if
!  you wanted different title labels. xt means that are using the same title whether the variable is used
!  vertically or horizontally. Many users however suppress the horizontal title when running tables.
!
dm $q2=$6/1,$7/1,$8/1,
dm $q2=$6-8,
x='Ate at a restaurant;
Went to see a film;
Went to watch a sporting event',
xt='Q2 Activities in the past month',
!
!This is a similar variable to $q1 except that it allows for multiple answers because respondents could have carried
!out any number of these activities.
!
!
finish data,
start tables,
!
!finish data means end the data stage and start tables means begin the stage where tables are specified.
!
!
t#1=$q1 * $q2,
t#2=$q2 *,
!
!Here is a simple table. It will make $q1 the rows of the table and $q2 the columns/banner/break/header.
!
!
!
!Having opened the .stp file in MRDCL, you will be presented with the options to compile, execute and print
!the .stp file. If you have already opened MRDCL, you may need to select File..> Run set up.
!
!Compile will check that the .stp has no errors and build internal program labels files.
!Execute will read data and increment tables
!Print will format the tables ready for printing.
!
!You will need to run all these STEPS here.
!
!When you have done this, you should be able edit or view the tables in MRDCL.MRDCL defaults to using Notepad.exe for
!this purpose. If you would prefer to use a different editor, you can change the program use in the Options menu to
!the program of your choice
!
!Finish tables concludes this .stp file. You can now move on to getstarted2.stp.
!
finish tables,
