...
When the data is imported, you may need to create a header for each row:
coded- showNote true header
trans Type step p01Name Option p01Value Use row as header p02Name Row p02Value 1 SearchTerm Rename columns with a row - The columns containing heat time data may need to be retyped. From the drop-down next to each column name, select Decimal type.
The
codeDQ
value in the Heat2 column is invalid data for Decimal type. You can use the following transform to turn it into a missing value. For purposes of calculating averages, you may or may not want to turn invalid data into zeroes or blanks. In this case, replacing the data as0.00
causes improper calculations for the metrics.d- hideNote true replace col:Heat2 with:'' on:'DQ'
trans p03Value '' Type step p01Name Column p01Value Heat2 p02Name Find p02Value 'DQ' p03Name Replace with SearchTerm Replace text or patterns Use the following to gather all of the heat data into two columns:
coded- unpivot col:hideNote true trans Type step p01Name Columns p01Value Heat1,Heat2,Heat3 p02Name Group size p02Value 1 SearchTerm Unpivot columns You can now rename the two columns. Rename
key
toHeatNum
andvalue
toHeatTime
.You may want to delete the rows that have a missing value for
codeHeatTime
:d- delete row:hideNote true trans Type step p01Name Condition p01Value ISMISSING([value]) SearchTerm Delete rows You can now perform calculations on this column. The following transforms calculate minimum, average (mean), and maximum times for each racer:
coded- hideNote true derive type:single value:MIN(HeatTime) group:Racer as:'BestTime'
D code hideNote true derive type:single value:AVERAGE(HeatTime) group:Racer as:'AvgTime'
D code hideNote true derive type:single value:MAX(HeatTime) group:Racer as:'WorstTime'
trans p03Value Racer Type step p01Name Formula type p01Value Multiple row formula p02Name Formula p02Value MIN(HeatTime) p03Name Group rows by p04Value 'BestTime' p04Name New column name SearchTerm New formula D trans p03Value Racer Type step p01Name Formula type p01Value Multiple row formula p02Name Formula p02Value AVERAGE(HeatTime) p03Name Group rows by p04Value 'AvgTime' p04Name New column name SearchTerm New formula D trans p03Value Racer Type step p01Name Formula type p01Value Multiple row formula p02Name Formula p02Value MAX(HeatTime) p03Name Group rows by p04Value 'WorstTime' p04Name New column name SearchTerm New formula To make the data look better, you might want to reformat the values in the
AvgTime
column to two decimal points:
coded- set col:AvgTime value:hideNote true trans Type step p01Name Columns p01Value AvgTime p02Name Formula p02Value NUMFORMAT(AvgTime, '##.00') SearchTerm Edit column with formula
Results:
After you use the move
transform to re-organize your columns, the dataset should look like the following:
...