C:\to_server\website\mrdcl-learning.com\mrdcl_files\DAT-03\run3.stp
start data,
serial number in columns 1-4,
card characters 1000,
!
ds $gender=$6/1,2,f,
x='Gender\Male;
Female;
Sum<s>',
xt='Gender',
!
ds $age=$7/1-4,e,
x='Age\
16-24;
25-34;
35-44;
45+;
Not stated<s>',
xt='Age group',
!
f=adf/anf,
>>  Warning at line 23 in C:\to_server\website\mrdcl-learning.com\mrdcl_files\DAT-03\run3.stp
>>  Last few chars parsed were {-44; 45+; Not stated<s>',xt='Age group',f=adf/anf,}
>>W 360 Format already set to this value
di $ishop=$8-9,
xt='Number of times shopping per month',
f=ifb0,
>>  Warning at line 27 in C:\to_server\website\mrdcl-learning.com\mrdcl_files\DAT-03\run3.stp
>>  Last few chars parsed were {-9,xt='Number of times shopping per month',f=ifb0,}
>>W 360 Format already set to this value
!
ds $shop=$ishop/0,1..5,6..10,>10,e,
x='None;
1 - 5 times;
6 - 10 times;
More than 10 times;
Not stated<z>',
xt='Number of times shopping per month',
!
dm $shop2=$ishop/0,>0,1..5,>5,e,
x='None;
Any;
1 - 5 times;
More than 5 times;
Not stated<z>',
xt='Number of times shopping per month (second set of ranges)',
!
dm $age2=$7/1,2,3+4,n1..2,e, !You could have also typed 1,2,3..4, or even 1,2,34,
x='16-24;
25-34;
35+;
NOT 16-34;
Not stated<z>',
xt='Age (grouped)',
!
ds $age_gender= $age/(1+2).$gender/1, !Always use brackets when you mix '+' and '.'
  $age/(1+2).$gender/2, !In this case it would be OK to miss out brackets
  $age/(3+4).$gender/1, !but if you typed $gender/1.$age/1+2
  $age/(3+4).$gender/2, !it would be WRONG
x='16-34 Male;
16-34 Female;
35+ Male;
35+ Female',
xt='Age within gender',
di $addupnumbers=2 * 3 + 6,
!This will return 12
!If you put brackets around (3 + 6), the answer would be 18
!
dm $q1=$10/1,$11/1,$12/1,$13/1,$14/1,$$/1..5,1.2.n4,e, !!!$$ is self-referencing the
           !!!the current variable
x='Brand A;
Brand B;
Brand C;
Brand D;
Brand E;
Any brand;
Brand A AND Brand B but not Brand D;
None of these',
xt='Q1 Brands heard of',
!
!!!This makes a temporary variable so that you can test for single/multi etc
dm $xq1=$q1/1-5,
dm $qq1=$xq1/m,s,b,nm,
x='Multi;
Single;
Blank;
Not multi',
xt='Brands',
!
dm $mybanner=$age,$gender,$q1/1..2,3..5,
x=$age + $gender + 'Brands heard of\A/B;C/D/E',
!
finish data,
start tables,
%jh='Test project<jc>',
%jf='Produced in a training session at ACNielsen India<jc>',
global bt#='All respondents',
f=urh/uch/clw6/spl180/mcs2,
!urh underlines row headings
!uch underlines column headings
!clw6 widens column width to 6 characters (gaps between columns and headings can also be changed)
!spl180 widens width of page (for landscape printing usually)
!bcs suppresses blank columns
!mcs2=suppresses columns with less than 2 (same as bcs but also 1 excluded)
select banner $mybanner,
!!This is using a standard banner of $gender, except for table 5 where
!!$age is specifically used.
t#1=$age * ,
t#1a=$gender *,
t#2=$shop * ,
t#3=$shop2 * ,
t#4=$age_gender * ,
t#5=$q1 * $age,
t#6=$qq1 * ,
finish tables,
