Some useful manipulations - separating a block of columns into two or more block (e.g. if men's & women's scores are in the same column, marked by a code in another column), combining columns, carrying out arithmetic with columns

**Why we'd use it** (situation)**:**

We have a large data set with several variables for each unit in the sample & we want to separate groups to get descriptive statistics [normal probability plots, stemplots, etc] for each group [For example - have class year, sex, major, SAT-M, SAT-V, GPA, for a group of students, want to separate data on women from data on men, perhaps to look at SAT-V separately, do plots of SAT-M against GPA separately for men & women, etc.]

**Method:**

Use

Manip>Stack/Unstack>Unstack Blocks of Columnscommand, For the box labeled "Unstack the following columns:" select (usually) all the data columns (select the columns for all the variables you want to work with). In the "Using subscripts in:" box put the column containing the code that identifies the groups. In the "Save unstacked data in blocks (one per subscript value)" boxes put a set of (new) columns - one set (one block) for each group. There must be as many columns in each block as there are in the "Unstack" box.

**Why we'd use it **(situation)**:**

We have data on the same variables from several groups, and we wish to make a single column with all the values of each variable in the same column. [For example : we have collected information on class year, sex, major, GPA on students in several courses, have entered these in columns perhaps c1-c4 for one course, c6-c9 for another, c12-c15 for another, etc & want all studets in one collection - perhaps to get overall stats on mean GPA, look for relationship of major to GPA for all data at once, etc.]

**Method:**

Use the

Manip>Stack/Unstack>Stack Blocks of Columnscommand In each of the boxes under "Stack two or more blocks of columns on top of each other" put (Using the "Select" button and the list of columns at the left) one set of columns (the data from one group - say c1-c4 in one bocx, c6-c9 in next, etc). In "Store stacked data in" put a set of columns to hold the combined columns. [Note: every box - including this one - must contain the same number of columns]. To keep track of which data are from which group, enter another (new) column name in the "Store subscripts in" box

**Why we'd use it **(situation)**:**

We have several columns (several variables) and we want to combine the values for each row into some single value [Perhaps before & after values of a variable for each unit and we want to find the change for each unit - as we do for paired data. We may want to take sum of SAT-V and SAT-M columns to get a total SAT for each individual, etc.]

**Method:**

Use the

Calc>Mathematical Expressionscommand. In the "Variable (new or modified)" box the column to hold the new variable. In "Expression" put the combination of existing columns. Use * for multiplication [Must be explicitly shown-parentheses are not enough], / for division, - for subtraction, + for addition, ** for power; other functions (Logten, cos Round-which rounds to a whole number) are usable - you have to type the name and use parentheses, Enter the columns by using the "Select" button with the list of data columns at the left of the window.

Examples:To make c6 the difference c4 minus c3, put cr in the "Result in" box, enter c4 - c3 in the "Expression" box.

If you want c8 to be five more than the product of c2 and c3 squared plus c5, put c8 in the "Result in" box and 5 + c2 * (c3**2) + c5 in the "expression" box.

**Why we'd use it** (situation)**:**

We want to work with the logarithms, or squares, or whatever of

onevariable (particularly used with regression questions) [for example, we have a column c2 but we want to calculate a regression line using the squares of these values].

**Method:**

Use the

Calc>Functionscommand. Select the "Input column" from the list at the left, give a (new) column for the "Result in" and select (by clicking on the button next to the name) the function to be used. [Note "Round" will round to whole number]

Last update 8/21/2000

*Maintained by cpeltier@saintmarys.edu*