Example of how to create a difference between two columns

Attached is a spec DIFFERENCEINCOLUMN.SPX that shows how to produce a 3rd column which is the difference of 2 existing columns. Table Manipulation must be used in order to accomplish this result.

This example shows how to calculate the difference for both tables that do not have any summary statistics (like mean, std, etc.) and those that do and also how to do this on a table where the percentage base is changing from row to row.

You probably CANNOT do statistical testing on these tables, although if the data is independent, unweighted, and you have no summary stats (or just don’t want to test them), you can use the print time statistical testing to test columns.

Column variable is created with 2 extra ‘dud’ categories. You could actually save a step in the table manipulation phase by creating the extra columns as copies of the originals.

There are a couple of ‘tricky’ things that are done on the edit and stubs to get the correct number of decimals to print in all the numbers. In particular the default number of decimals for a frequency on the table is set to 1, and then the colinfo sets all columns except the difference column(s) to fdec=0, and use fdec=0 on all the summary rows.

>PurgeSame>Prtfile Differenceincolumn>Createdb Differenceincolumn,Dup=Replace~Specfile Differenceincolumn~Set Table_Drop_Mode=1 ~In Differenceincolumn^Dat,Ascii=20 ~DefTabset= Ban1:Header=:Sample Column Different Table }Edit=: -ColTna Vper=Ar Cwid=12 Swid=30 Pgwid=80 Sdec=2 PutChars=-0B-  Fdec=1 Colinfo=(fdec=0/fdec=0/ -vper/w=0) RankIfIndicated }Stub_Preface=:[-Vper,Fdec=0] Total[-Vper,Fdec=0] No Answer[Prt=Ar,Fdec=0] Total Answering }Banner=: