Hi @jinsejoseph ,
building on @txnelson s approach there may be a shorthand script using some built in features. this was achieved by maximum clicking and minimum generalization of the script.
this approach uses the two commands: Combine and Text to column. combine has the advantage that it ignores missing values. in this case it is used as concatenate without missing values.
then, text to columns comes in hand when we want the final data in separate columns.
please do let us know if it works or needs further generalization for your purposes.
ron
dt = New Table( "original data set",
Add Rows( 36 ),
New Column( "Data 01",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [1, 1, 1, ., ., ., ., ., ., ., ., ., ., ., ., 11, 11, 11, ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., .] )
),
New Column( "Data 02",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [., ., ., 2, 2, 2, ., ., ., ., ., ., ., ., ., ., ., ., 12, 12, 12, ., ., ., ., ., ., ., ., ., ., ., ., ., ., .] )
),
New Column( "Data 03",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [., ., ., ., ., ., 3, 3, 3, ., ., ., ., ., ., ., ., ., ., ., ., 13, 13, 13, ., ., ., ., ., ., ., ., ., ., ., .] )
),
New Column( "Data 04",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [., ., ., ., ., ., ., ., ., 4, 4, 4, ., ., ., ., ., ., ., ., ., ., ., ., 14, 14, 14, ., ., ., ., ., ., ., ., .] )
),
New Column( "Data 05",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [., ., ., ., ., ., ., ., ., ., ., ., 5, 5, 5, ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., .] ),
Set Display Width( 59 )
),
New Column( "Data 06",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [10, 10, 10, ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., .] )
),
New Column( "Data 07",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [., ., ., 20, 20, 20, ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., 200, 200, 200, ., ., ., ., ., ., ., ., .] )
),
New Column( "Data 08",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [., ., ., ., ., ., 30, 30, 30, ., ., ., ., ., ., ., ., ., ., ., ., 300, 300, 300, ., ., ., ., ., ., ., ., ., ., ., .] )
),
New Column( "Data 09",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [., ., ., ., ., ., ., ., ., 40, 40, 40, ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., .] ),
Set Display Width( 67 )
),
New Column( "Data 10",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [., ., ., ., ., ., ., ., ., ., ., ., 50, 50, 50, ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., .] )
)
);
// now we get to work
// Get the columns names to combine.
colNames = dt << get column names( string, continuous );
// Combine columns using list - here is the trick, it ignores missing values
dt << Combine Columns(
columns( eval (colNames) ),
Column Name( "combined" ),
Delimiter( "," ),
Multiple Response( 0 )
);
// Text to columns - now we can uncombine the data into as many columns there is actual data. this is robust to any number of events per row.
dt << Text to Columns(
columns( :combined ),
Delimiters( "," )
);