Title: Creating Extensive Shift Tables
1Creating Extensive Shift Tables
- OR
- How I Learned to Type 1,388,571 wpm!
- Kelley Weston
2The goal
- Create a format that would consist of all the
possible combinations of several values.
For example "M1TM" - "M1TM" "Missing to 1
to Trace to Missing"
3The usual way of accomplishing this
- Typing all the combinations into a format.
- When there are only 4 or 5 possible values in 2
positions, this is no problem.
4The problem
- We are starting with 7 values, in each of 4
positions. This results in 7 7 7 7 2401
combinations. The problems include - time
- ensuring that all possible combinations are
accounted for, with no repetitions or omissions - accuracy
5What I need to create
6 value CAT_ALL (default 40 fuzz 0 min 1
max 40 ) "----" - "----" missing"
"---1" - "---1" "- to 1"
"---2" - "---2" "- to 2" "---M" -
"---M" "- to Missing" "---N" -
"---N" "- to None" "---O" - "---O"
"- to Other" "---T" - "---T" "-
to Trace" "--1-" - "--1-" "- to 1"
"--11" - "--11" "- to 1 to 1"
"--12" - "--12" "- to 1 to 2"
"--1M" - "--1M" "- to 1 to Missing"
"--1N" - "--1N" "- to 1 to None"
"--1O" - "--1O" "- to 1 to Other"
"--1T" - "--1T" "- to 1 to Trace"
"--2-" - "--2-" "- to 2" "--21" -
"--21" "- to 2 to 1" "--22" -
"--22" "- to 2 to 2" "--2M" -
"--2M" "- to 2 to Missing" "--2N" -
"--2N" "- to 2 to None" "--2O" -
"--2O" "- to 2 to Other" "--2T" -
"--2T" "- to 2 to Trace" "--M-" -
"--M-" "- to Missing" "--M1" -
"--M1" "- to Missing to 1" "--M2" -
"--M2" "- to Missing to 2" "--MM" -
"--MM" "- to Missing to Missing"
"--MN" - "--MN" "- to Missing to None"
"--MO" - "--MO" "- to Missing to Other"
"--MT" - "--MT" "- to Missing to Trace"
"--N-" - "--N-" "- to None"
"--N1" - "--N1" "- to None to 1"
"--N2" - "--N2" "- to None to 2"
"--NM" - "--NM" "- to None to Missing"
"--NN" - "--NN" "- to None to None"
"--NO" - "--NO" "- to None to Other"
"--NT" - "--NT" "- to None to Trace"
"--O-" - "--O-" "- to Other" "--O1"
- "--O1" "- to Other to 1" "--O2" -
"--O2" "- to Other to 2" "--OM" -
"--OM" "- to Other to Missing" "--ON"
- "--ON" "- to Other to None" "--OO"
- "--OO" "- to Other to Other"
"--OT" - "--OT" "- to Other to Trace"
"--T-" - "--T-" "- to Trace" "--T1"
- "--T1" "- to Trace to 1" "--T2" -
"--T2" "- to Trace to 2" "--TM" -
"--TM" "- to Trace to Missing" "--TN"
- "--TN" "- to Trace to None" "--TO"
- "--TO" "- to Trace to Other"
"--TT" - "--TT" "- to Trace to Trace"
"-1--" - "-1--" "- to 1" "-1-1" -
"-1-1" "- to 1 to 1" "-1-2" -
"-1-2" "- to 1 to 2" "-1-M" -
"-1-M" "- to 1 to Missing" "-1-N" -
"-1-N" "- to 1 to None" "-1-O" -
"-1-O" "- to 1 to Other" "-1-T" -
"-1-T" "- to 1 to Trace" "-11-" -
"-11-" "- to 1 to 1" "-11M" -
"-11M" "- to 1 to 1 to Missing"
"-11N" - "-11N" "- to 1 to 1 to None"
"-11O" - "-11O" "- to 1 to 1 to Other"
"-11T" - "-11T" "- to 1 to 1 to Trace"
"-12-" - "-12-" "- to 1 to 2"
"-12M" - "-12M" "- to 1 to 2 to Missing"
"-12N" - "-12N" "- to 1 to 2 to
None" "-12O" - "-12O" "- to 1 to 2
to Other" "-12T" - "-12T" "- to 1 to
2 to Trace" "-1M-" - "-1M-" "- to 1
to Missing" "-1M1" - "-1M1" "- to 1
to Missing to 1" "-1M2" - "-1M2" "-
to 1 to Missing to 2" "-1MM" - "-1MM"
"- to 1 to Missing to Missing" "-1MN"
- "-1MN" "- to 1 to Missing to None"
"-1MO" - "-1MO" "- to 1 to Missing to Other"
"-1MT" - "-1MT" "- to 1 to Missing to
Trace" "-1N-" - "-1N-" "- to 1 to
None" "-1N1" - "-1N1" "- to 1 to
None to 1" "-1N2" - "-1N2" "- to 1
to None to 2" "-1NM" - "-1NM" "- to
1 to None to Missing" "-1NN" - "-1NN"
"- to 1 to None to None" "-1NO" -
"-1NO" "- to 1 to None to Other"
"-1NT" - "-1NT" "- to 1 to None to Trace"
"-1O-" - "-1O-" "- to 1 to Other"
"-1O1" - "-1O1" "- to 1 to Other to 1"
"-1O2" - "-1O2" "- to 1 to Other to 2"
"-1OM" - "-1OM" "- to 1 to Other to
Missing" "-1ON" - "-1ON" "- to 1 to
Other to None" "-1OO" - "-1OO" "- to
1 to Other to Other" "-1OT" - "-1OT"
"- to 1 to Other to Trace" "-1T-" -
"-1T-" "- to 1 to Trace" "-1T1" -
"-1T1" "- to 1 to Trace to 1" "-1T2"
- "-1T2" "- to 1 to Trace to 2"
"-1TM" - "-1TM" "- to 1 to Trace to Missing"
"-1TN" - "-1TN" "- to 1 to Trace to
None" "-1TO" - "-1TO" "- to 1 to
Trace to Other" "-1TT" - "-1TT" "- to
1 to Trace to Trace"
7The solution
8Lots of Pepsi !
9 The Real Solution
- Let SAS create the combinations AND the meanings
for them.
10The method
- Create a data set with the individual values and
meanings. This will only consist of a very few
records. In our case, we had 7 values. - Let SAS create all the combinations and put them
into a data set. We will cross the dataset with
itself 3 times to create the 4 positions.
Remember the Cartesian product? - Post-process the dataset to account for baseline
and missing values. - Create the datasets from which we will create the
permanent formats. - Write out the permanent formats.
- Step 1 step 2a step 2b step 2c step 3
step 4a step 4b step 5
11Step 1
- data work.temp
- length x 1
- y 7
- x 'T' y 'Trace' output
- x '1' y '1' output
- x '2' y '2' output
- x 'O' y 'Other' output
- x 'M' y 'Missing' output
- x '-' y '-' output
- x 'N' y 'None' output
- run outline
12Step 2a
- proc sql
- create table work.temp as
- select x, y from work.temp
- order by x
- outline
13Step 2b
- create table work.temp2 as
- select (a.x !! b.x) as x,
- (a.y !! ' to ' !! b.y) as y
- from work.temp as a,
- work.temp as b
- outline
14Step 2c
- create table work.temp3 as
- select (a.x !! b.x)
- as x length 200,
- compbl(a.y !! ' to ' !! b.y)
- as y length 200
- from work.temp2 as a,
- work.temp2 as b
- outline
15Step 3
- data work.temp3 (drop to_)
- set work.temp3
- format these especially for baseline records
- if substr(x, 2) EQ '---'
- then y scan(y, 1) !! " at baseline"
- eliminate "to -"
- do while (index(y, "to -") GT 0)
- to_ index(y, "to -")
- y left(trim(substr(y, 1, (to_ - 1)) !!
- substr(y, (to_ 4))))
- end
- y compbl(y)
- run
- outline
16Step 4a
- data work.ctrl
- length x y 200
- length fmtname end 200
- set work.temp end last
- retain fmtname 'cat' type 'c'
- rename x start
- y label
- end x
- run outline
17Step 4b
- data work.ctrl2
- length x y 200
- length fmtname end 200
- set work.temp3 end last
- retain fmtname 'cat_all' type 'c'
- rename x start
- y label
- end x
- run
- outline
18Step 5
- proc format library library cntlin
work.ctrl - run
- proc format library library cntlin
work.ctrl2 - run
- outline
19Conclusion
- And thats how I learned to type 1,388,571 wpm !
20And boy, am I tired !