Following is a simple set-up that produces four tables from a data file which contains 500 characters per line in fixed format ASCII. The four tables contain accumulated figures from the 60 lines (respondents) in the data file.
start control,
* First example using ASCII data
c=first.asc,
cep,
finish control,
start data,
serial number in 1-5,
card characters binary 500,
!
ds $sex=$8/1,2,
xt='Sex of respondent',
x='Sex\Male;Female',
!
ds $q1=$9/1-3,e,
xt='Rating of test product',
x='Rating\Good<v1>;Average<v0>;Poor<v-1>;No answer',
!
dm $q2=$10/1,$11/1,$12/1,
xt='Products eaten every day',
x='Every Day\Bread;Meat;Potatoes',
!
di $q3=$13-14,
xt='Cups of tea drunk daily',
!
ds $sq3=$q3/0,1..5,>5,e,
xt='Cups of tea drunk daily',
x='Tea\None;Up to 5;Over 5;Faulty response',
!
dc $q4=$15-18,
xt='Title',
!
ds $sq4=$q4/'Mr ','Mrs ','Miss','Ms ',e,
xt='Title',
x='Title\Mr.;Mrs.;Miss;Ms.;Other',
!
finish data,
start tables,
!
%jh='Example tables',
f=lpp46/spl120/psv/clw6/urh/uch,
!
t #1=$q1*$sex,
t #2=$q2*$sex,
t #3=$sq3*$sex,
t #4=$sq4*$sex,
!
finish tables,
The first table in the output Tables file will look something like this -
Example tables Page 1
Table 1
Rating of test product
by Sex of respondent
Sex
-------------
Total Male Female
Total 60 24 36
Rating
------
Good (1.0) 22 10 12
37% 42% 33%
Average (0.0) 21 7 14
35% 29% 39%
Poor (-1.0) 13 3 10
22% 13% 28%
No answer 4 4 -
7% 17% -%
Mean score .2 .4 .1
The other three tables will be similar except that the rows will be different depending on which variable was used as the stub.
This set-up contains three stages which all begin with START and end with FINISH -
Please see the following sections: