30 3 Syntax3.3 PracticalUse the VARIATE directive to define variates a - g holding the following sets of numbers:a 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12b 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1c 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23d 2.2, 3.4, 4.6, 5.8, 7, 8.2, 9.4, 10.6, 11.8, 13, 14.2, 15.4e 1.5, 1.5, 9, 9, 11, 11, 3.3, 3.3, 6, 6, 2, 2f 1.5, 9, 11, 3.3, 6, 2, 1.5, 9, 11, 3.3, 6, 2g 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4Print their values in parallel, in the Output window, with enough decimal places to displayall the significant figures of each one.3.4 Abbreviation rulesNames of directives, options, parameters, and functions (see Section 5.1) are known assystem words, and these can always be abbreviated to four characters. If more than theminimum number of characters is given for any system word, they will be checked as faras the 32nd; characters from the 33rd onwards are ignored. Names of procedures in thestandard GenStat library are defined so that they too can be abbreviated to fourcharacters. Names of user-defined procedures are required to differ only in the first eightcharacters (although GenStat does give a warning if you define a name whose first fourcharacters are the same as an existing procedure). So, unless you are using proceduresonly from the standard GenStat library, it may be safer to give eight characters for theirnames.Option and parameter names can usually be abbreviated even further. For everydirective or procedure, an implicit order is defined for its options and for its procedures.For PRINT, as shown above, the ordering of the parameters is STRUCTURE,FIELDWIDTH, DECIMALS, CHARACTERS, SKIP, FREPRESENTATION, JUSTIFICATION,MNAME, DREPRESENTATION, HEADING and TLABELS. The rule is that you need specifyonly sufficient letters to distinguish each parameter from the parameters that occur beforeit in this (implicit) list. Above we have printed the minimum form for each one in boldletters; so for example you can abbreviate FIELDWIDTH to F, as this is preceded only bySTRUCTURE, but SKIP requires the two letters SK. However, as already mentioned, if youare uncertain about the ordering for a particular directive, it is always sufficient to specifyfour characters.This abbreviation rule also applies to string tokens. Thus, for example,READ [PRINT=data,errors] daycan be written asREAD [PRINT=d,e] day(The READ directive, which reads values into data structures, is described in Section 4.1.)An option or parameter name may be omitted altogether, along with its accompanyingequals sign, if GenStat can deduce it from the position of the setting within the statement.In the statementPRINT [CHANNEL=2; SERIAL=yes] \STRUCTURE=name,pay,hours,rate; DECIMALS=0,2you can leave out CHANNEL= as CHANNEL is the first option of PRINT: unless you sayotherwise (by giving the option name explicitly), GenStat assumes that the first optionsetting in a statement is for the first option in the implicit ordering for the directive (orprocedure). Similarly, as STRUCTURE is the first parameter of PRINT, you can also omitSTRUCTURE=, to obtainPRINT [2; SERIAL=yes] name,pay,hours,rate; DECIMALS=0,2For subsequent options (and parameters), GenStat looks to see which option (or
3.4 Abbreviation rules 31parameter) comes after the current one in the implicit ordering. Thus, after CHANNELGenStat would expect by default to find SERIAL; as our statement also has SERIALstraight after CHANNEL, this can be omitted too.PRINT [2; yes] name,pay,hours,rate; DECIMALS=0,2You can include null settings in a statement by typing nothing (other than spaces orcomments or continuation symbols) between two semi-colons. If you insert a null settingfor FIELDWIDTH, GenStat will then be able to deduce that our third parameter setting isfor DECIMALS and so you can simply putPRINT [2; yes] name,pay,hours,rate; ; 0,2Again this does require you to know the implicit ordering for the directive or procedure,but it can save a great deal of typing as you get to know GenStat better.3.5 Repeating a statementThe repetition symbol & provides a very convenient way of repeating a statement. Itterminates the previous statement, if necessary, and then repeats the name of thestatement together with any options that were set. So, for example, you could type thestatementsasREAD [CHANNEL=2] year : READ [CHANNEL=2] day,tempREAD [CHANNEL=2] year & day,tempYou can also modify the options by including further settings after &. ThusREAD [CHANNEL=2] yearREAD [CHANNEL=2; SERIAL=yes] day,tempREAD [CHANNEL=3; SERIAL=yes] sunshine,windspeedcan be simplified toREAD [CHANNEL=2] year& [SERIAL=yes] day,temp& [CHANNEL=3] sunshine,windspeed3.6 PracticalBelow we show a rather verbose GenStat program, stored as Shop.gen. Run theprogram to see what output it gives.TEXT [NVALUES=11] branchVARIATE [NVALUES=11] sales01,sales02VARIATE [NVALUES=11] frontage,depthREAD [PRINT=data,errors,summary] branch, sales01, sales02,\frontage, depthAshford 4741100 496700 25 33Bradford 3386800 350100 21 32Chelmsford 645800 395200 15 22Dartford 2381200 298900 12 28Fordingbridge 1379600 412000 12 25Guildford 2727300 234700 16 26Hereford 2993300 358500 14 32'Milford Haven' 3409000 460600 18 24Oxford 4752400 439100 15 30Stafford 4117400 473700 16 28Twyford 942500 294900 12 16 :CALCULATE [PRINT=*] sales01 = sales01/100CALCULATE [PRINT=*] sales02 = sales02/100CALCULATE [PRINT=summary] allsales = sales01 + sales02CALCULATE [PRINT=summary] sale_pm2 = \allsales / 2 / (frontage * depth)