0% found this document useful (0 votes)
62 views40 pages

IT Spss Ppractical

SPSS Statistics is a comprehensive system for analyzing data. It allows users to enter data, specify variable types, generate reports, and perform both descriptive and complex statistical analyses. The interface provides toolbars and dialog boxes to perform tasks without typing commands. Data is entered into cases (rows) and variables (columns) in the data editor spreadsheet view. Variables are specified by defining characteristics like name, type, width, and label. The tutorial demonstrates how to open SPSS, specify variables, enter data for sample patient records, and save the work file. It also reviews how to insert new cases and variables.

Uploaded by

Asia meso
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views40 pages

IT Spss Ppractical

SPSS Statistics is a comprehensive system for analyzing data. It allows users to enter data, specify variable types, generate reports, and perform both descriptive and complex statistical analyses. The interface provides toolbars and dialog boxes to perform tasks without typing commands. Data is entered into cases (rows) and variables (columns) in the data editor spreadsheet view. Variables are specified by defining characteristics like name, type, width, and label. The tutorial demonstrates how to open SPSS, specify variables, enter data for sample patient records, and save the work file. It also reviews how to insert new cases and variables.

Uploaded by

Asia meso
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

Getting Started with SPSS

1- Introduction:
SPSS Statistics is a comprehensive system for analyzing data. SPSS stands for
(Statistical Package for the Social Sciences).
SPSS Statistics can;
- Take data from almost any type of file and use them to generate tabulated
reports, charts, and so on,
- Conduct descriptive statistics, and complex statistical analyses.
- SPSS Statistics makes statistical analysis more accessible for the beginner
and more convenient for the experienced user.
- Simple menus and dialog box selections make it possible to perform
complex analyses without typing a single line of command syntax.
- The Data Editor offers a simple and efficient spreadsheet-like facility for
entering data and browsing the working data file.

2- Introducing the interface


When SPSS 16.0 for Windows is first opened, a default dialogue box appears that
gives the user a number of options, Look at figure (1).

Figure (1): default dialogue box


In this tutorial, students first need to open a new sheet in order to enter data.
Therefore, student must choose from dialogue box (Type in Data) option and then
press OK button.
Further options will be discussed later in this course. This dialogue box can be
prevented from opening in the future by checking this option at the bottom of the
box that says ( Don’t show this dialogue in the future).
__________________________________________________________________

SPSS also provides a toolbar (It called also command functions) for quick and easy
access to common tasks. Look at figure (2)

Toolbar or
command functions

Figure (2): Toolbar or command functions

A brief description of each tool can be obtained by placing the cursor over the tool
symbol and the display of the toolbar can be controlled using the command
Toolbars. Figure(3)

A brief description of data tool

Figure (3): shows the brief description of data tool


3- Data Entry
When you use SPSS, you work in one of several windows:
a. The data view: The data view displays your actual data and any new
variables you have created. Figure (4)

Each raw represents


one case

Data view

Figure (4): data view spreadsheet


b. The variable view: which allows the types of variables to be specified and
viewed. Figure(5)

Variable view

Figure (5): variable view spreadsheet


Each column represents all variables
that we are interested in
Note: The user can toggle between the windows by clicking on the appropriate tabs
on the bottom left of the screen. Figure (6)

Data View Variable View

Figure (6): shows data editor windows

Note that, In the variable view spreadsheet , There are 10 characteristics to be


specified under the columns of the Variable View. Figure (7). In this tutorial, we
will focus on some of them (Name, Type, width, decimals, Label and values)

Characteristics to be specified

Figure (7): shows the characteristics to be specified under the columns


of the Variable.
Characteristics are:
 Name : The chosen variable name. This can be up to eight alphanumeric
characters, But you should know that;
 Variable Name must begin with a letter (capital letter or small letter).
 The underscore (_) is allowed to be in variable name.
 Hyphens (-), Ampersands (&), and spaces cannot be used in variable
name.
Example: try to type the following;
(Age group ,, agegroup ,, age*group ,, age_group ,,, 3age_group ,, Age-group)
Find out which one is the right name of this variable.

 Type : The type can be changed by highlighting the respective entry in the
second column of the Variable View and clicking the three-periods symbol
(…) appearing on the right-hand side of the cell. This results in the Variable
Type box being opened, which offers a number of types of data including
various formats for numerical data, dates, or currencies, string. Look at
figure (8). Choose the type you need and then click ok button.

Figure (8): shows different type of variables


 Width : The default width of numerical variable entries is eight. The width
can be increased or decreased

 Decimals :The number of digits to the right of the decimal place to be


displayed for data entries. If the number is integer, we type zero on the
decimals place.

 Label: A label attached to the variable name. In contrast to the variable


name, this is not confined to eight characters and spaces can be used. It is
generally a good idea to assign variable labels.

 Values : To understand this character, let’s work on this example; our data
set included a categorical variable which is the gender, ( male and female)
we can do coding to facilitate data entry . code “1” was declared to represent
Males and code “2” for females. Look figures (9) and (10)

After each
code click Add

Figure (9): coding variable.. Gender >> step 1


After each code
click Add

Press OK after finishing all


the code that you need

Figure (10): coding variable.. Gender >> step 2


-------------------------------------------------------------------------------------
Now; we will use SPSS to;
1- Specify the variables.
2- Data entry
Data has been collected from the records of 18 patients that have been admitted to
the TMC hospital.
 To specify variables …..
 First, Fill the empty cells of the following table.
Variables Name Type width Decimals label values
Record_no Patient Record Number
Gender Patient Gender
Date.admission dd.mm.yyyy Date of admission to the hospital
age Patient age
weight Patient weight
height Patient height
address Where do you live?
Smoking Do you smoke?
Education Patient level of education
ptstatus patient status
Date.discharge mm/dd/yy Date of discharge from the hospital
Medication_time hh:mm what time of day should you take the
medication?
To start specify variables using spss
- Open variable view window, and start to specify the variables as you learned
in the last tutorial . figure (11)

Fig(11): SPSS Data Editor Window


- Start with the first variable which is patient record number.
 In the name cell, type the name of the variable, Taking into account
the constraints that have been explained.
 From the (Type), Choose the appropriate type for this variable.
 Determine the width (should be 4 digits) and decimals (should be
zero) for this variable.
 Write the full name of the variable in label cell.
 Determine the value of the variable. (there is no values).
- Repeat the steps with each variable
- When you finish, Your variable window will appear like the following. Look
figure (12)
Figure (12): variable view window
 To save your work:
 File >>> save as>>>
 Give name to your file (Ex: Data_1), and Choose the place that
you prefer to save your work in, e.g. desktop.
 Click save .
 Open the existing file:
To open an existing file again,
File >>> open>>> data …
figures (13, 14,15)

Figure (13): opening an existing file in SPSS

Figure (14): opening an existing file in SPSS Figure (15): opening an existing file in SPSS
To start,, open data view and enter the following data.

 Save your work.


File >> save
------------------------------------------------------------------------------------

Editing and Modifying Data

1- Inserting New Cases

Adding new cases to the end of your data is easy. Just move to that row and put in
the data. However, if you want to insert a case between two existing cases, you
need to use the "Insert Case" command. To do so;

- Open variable view window.


- Highlight the entire row below where you want the case inserted.
- Choose "Insert Case" from the "Edit" menu. Look at figure (16).
Fig (16): Insert New Cases

2- Inserting New Variables

Adding new variables to the end of your data is easy. Just move to that column and
define a variable as normal. However, if you want to insert a variable between two
existing variables you need to use the "Insert Variable" command. To do so;

- Open variable view window.


- Highlight the entire row where you want the variable inserted.
- Go to the "Edit" menu and choose "Insert Variable". Look at figure (17).
- Identify or specify the new variable by giving name to it, choose its type,
width, decimals, label, and value if needed, as it has been explained before.

Fig (17): Insert New Variables


3- Finding and replacing:
It is also possible to search and replace values, but only in a selected
variable. Look at figures (18,19,20).
- Finding:
 Highlight the variable that you need to find specific value(s) in.
 Go to Edit and choose Find, look at figure (18)

Figure (18) : Find values

- Replacing:
 Highlight the variable that you need to replace specific value(s) with other
values.
- Go to Edit and choose Replace. Look at figure (19,20)

Figure (19): Replace Value


Figure (20): Replace Value

4- Select Cases
SPSS allows us to select part of the data set for further analysis, while
excluding the remaining cases from these analyses.
Examples:
Ex 1: We need to select all Male from our data, and excluding all Females.
The procedure is found by choosing Select cases from the Data Menu.
Figure(21)

Figure(21): Select cases from Data Menu

We then have several "Select" options within the dialogue box that comes up after
clicking on select cases, so we can tell SPSS which data to select and which to
ignore. The select dialogue box looks like the following figure (22).

Figure(22): Select cases options


First, we have to specify how to select data and which data to retain for the
analyses:

 All cases
This option actually uses all data in the file. Click on this radio button and then
click the OK button to get all your data .

 If condition is satisfied
This option allows us to specify a rule based on values of variables; all cases that
meet the criteria are retained. After clicking on the radio button for this option, we
click on the "If..." button to bring up an additional dialogue box (figure 23) so we
can define the rule for including or excluding data:

Figure(23): If Condition in Select cases

We want to specify a condition in the right box based on one or more variables
listed in the box to the left. In our example, we have a variable for gender coded as
1 for male and 2 for female, we can select only the men for analysis by selecting
"gender =1" as shown below: fig(24)
Fig(24): select male by using if condition

After that we should click Continue button, then clicking on the OK button will
perform the selection. cases that are not being used with have a slash through the
case number. Fig(25)

Fig(25): selecting all Male


Note: it is very important to turn off any previous selection by going back to
Data Menu select cases and chose all cases. This procedure should be performed
before starting with another selection .
__________________________________________________________________
Ex2: We want to select all (>=50 ) year old female.
The answer will be shown in following figures (26, 27)

Figure (26): if condition for Ex2.

Figure (27): select cases for Ex2.


5- Compute New Variable

SPSS has very powerful capabilities for creating new variables as a function of
existing variables.

Ex: We want to add 5 kg to the weight of each patient .

To do so, select the compute option from the Transform menu, Figure (28)

Fig(28): Compute Option

Selecting this option will bring up the compute dialogue box. Fig(29)
Fig(29): Compute Variable Window

First, we need to supply a name for the target variable (i.e., the new variable SPSS
will create to contain the new values. Thus, we would name the new variable
"New_weight":Fig(30)

Fig(30): how to create Target_variable

The next step is to define for SPSS how the new values should be computed,
essentially giving SPSS a formula. To add 5 kg., we type "weight + 5 " in the
numeric expression field: Fig(31)

Fig(31): represent compute variable functions

After we have clicked on the OK button, the new variable "New_Weight" is


created: Fig (32)

Fig(32): data view window that shows the new variable


6- Recoding (Transforming) Variables :

Sometimes you will want to transform a variable by grouping its categories or


values together. For example, you may want to change a continuous variable into a
categorical variable, In SPSS, this type of transform is called recoding.

In SPSS, there are two basic options for recoding variables:

1. Recode into Different Variables


2. Recode into Same Variables

Each of these options allows you to re-categorize an existing variable. Recode into
Different Variables create a new variable without modifying the original variable,
while Recode into Same Variables will permanently change the original variable.
In general, it is best to recode a variable into a different variable so that you never
alter the original data and can easily access the original data if you need to make
different changes later on.

1- Recode into Different Variables ;

Recoding into a different variable transforms an original variable into a new


variable. That is, the changes do not change the original variable; they are instead
applied to a copy of the original variable under a new name.

Example: We will recode age as age group, Age groups are;

(20-30), (31-40), (41-50), (51_ 60), (> 61)

To recode Age into different variables, click Transform > Recode into Different Variables.
Fig(33)

The Recode into Different Variables window will appear. Fig(34)

Fig(34): Recode into Different variable window

The left column lists all of the variables in your dataset. Select the variable you wish to recode
by clicking it (in this example, variable is Age). Click the arrow in the center to move the
selected variable to the center text box, (1).

1 Input Variable -> Output Variable: The center text box lists the variable(s) you
have selected to recode, as well as the name your new variable(s) will have after
the recode. You will define the new name and Label in 2 .
2 Output Variable: Define the name and label for your recoded variable(s) by
typing them in the text fields the new name in our example is (age_group) and the
Label is (Patient’s age group),. Once you are finished, click Change. Now the
center text box, will display both the name of the original variable as well as the
name for the new variable ( “Age --> Age_group”).

3 Old and New Values: Click the Old and New Values to specify how you wish to recode the
values for the selected variable.

- Old and New Values

Once you click Old and New Values, a new window where you will specify how to transform
the values will appear.Fig(35)

Fig(35): Old and New values window

1 Old Value: Specify the type of value you wish to recode (e.g., a specific value, missing data, or
a range of values)

 Value: Enter a specific numeric code representing an existing category.


 Range: For use with ordered categories or continuous measurements. Enter the lower and
upper boundaries that should be coded. The recoded category will include both endpoints, so
data values that are exactly equal to the boundaries will be included in that category.
 Range, LOWEST through value: For use with ordered categories or continuous measurements.
Recode all values less than or equal to some number.
 Range, value through HIGHEST: For use with ordered categories or continuous measurements.
Recode all values greater than or equal to some number.
 All other values: Applies to any value not explicitly accounted for by the previous recoding rules.
If using this setting, it should be applied last.

2 New Value: Specify the new value for your variable

3 Old -> New: Once you have selected the old and new values for your selected variable in (1)
and (2), click Add in area (3), Old-->New. The recode that you have specified now appears in
the text field. If you need to change one of the recodes that you have added to the Old-->New
area section, simply click on the one you wish to change and make changes in (1) and (2) as
necessary.

You will need to repeat these steps for each value that you wish to recode. Once you have
specified all the transformations that you wish to make for the selected variable, click the
“Continue” button.

- Running the Procedure for our example (Age – Age_group)

1. Click Transform > Recode into Different Variables.


2. Double-click on variable Rank to move it to the Input Variable -> Output Variable box. In the
Output Variable area, give the new variable the name age_group, then click Change.
3. Click the Old and New Values button.
1. Define the age_group interval (1):
1. In the Old Value area click Range and enter 25 in the box below, and enter 30 in
through box; in the New Value area click Value and enter 1. Then click Add.
2. Define the age_ group interval (2):
1. In the Old Value area back to the Range and enter 31 in the box below, and
enter 40 in through box; in the New Value area click Value and enter 2. Then
click Add.
3. Define the age_ group interval (3):
1. In the Old Value area back to the Range and enter 41 in the box below, and
enter 50 in through box; in the New Value area click Value and enter 3. Then
click Add.
4. Define the age_ group interval (4):
1. In the Old Value area back to the Range and enter 51 in the box below, and
enter 60 in through box; in the New Value area click Value and enter 4. Then
click Add.
5. Define the age_ group interval (5): here we need all ages > 60
1. In the Old Value area go to the through to the HIGHEST and enter 61 in the box
below, in the New Value area click Value and enter 5. Then click Add.
6. When finished, click Continue. then Click OK. The window will appear like figure (36)

Fig(36): Recode ‘’age’’ variable to the new variable called ‘’age_group’’

2- Recode into Same Variables

Recoding into the same variable (Transform > Recode into Same Variables)
works the same way as described above, except for that any changes made will
permanently change the original variable. That is, the original values will be
replaced by the recoded values.

In general, it is good practice not to recode into the same variable because it
overwrites the original variable. If you ever needed to use the variable in its
original form (or wanted to double-check your steps), that data would be lost.

__________________________________________________________________

Statistical Techniques Available in SPSS (in Analyze Menu)


SPSS is a comprehensive statistical package. It is capable of performing many
statistical data analyses and report the summary. The procedures available in SPSS
are under the Analyze Menu. The results from performing any analysis are
displayed in the OUTPUT Editor Window. In this tutorial notes, we will not be
able to cover all of the statistical techniques available in SPSS. Instead, we will
focus on the following: fig(37)

1- Descriptive Statistics.
2- Tables.
3- Graphs.
4- Compare Mean.

Fig(37)

1- Descriptive Statistics
You will want to begin with descriptive analyses of your data. These analyses are
called descriptive because they allow you to summarize large amounts of data.
Descriptive statistics include many statistics orders, however here we will focus on
the following: fig(38)

 Frequencies (Counts, Percents and charts).


 Crosstabs .
 Measures of central tendency (Mean, Median, Mode)
 Measures of variability (e.g., range and standard deviation). Fig (38): Analyze

In many cases, descriptive statistics will be sufficient to answer most researchers


questions.
a. Frequencies ( count, percents, and charts) for Categorical Data

The Frequencies procedure can produce summary measures for categorical


variables in the form of frequency tables, bar charts, or pie charts.

To run the Frequencies procedure;

click Analyze > Descriptive Statistics > Frequencies. Fig(39,40)

Fir(39): Descriptive statistics , Frequencies

Fid(40): Frequencies Window

1- Variable(s): The variables to produce Frequencies output for. To include a


variable for analysis, double-click on its name to move it to the Variables box.
Moving several variables to this box will create several frequency tables at once.

2- Statistics: Opens the Frequencies: Statistics window, which contains various


descriptive statistics. Fig(41)
Fig(41): statistics window

The vast majority of the descriptive statistics available in the Frequencies:


Statistics window are never appropriate for nominal variables, and are rarely
appropriate for ordinal variables in most situations. There are an exception to this:

 The Mode (which is the most frequent response) has a clear interpretation when applied
to most nominal and ordinal categorical variables.

Note: If your categorical variables are coded numerically, it is very easy to mis-
use measures like the mean and standard deviation. SPSS will compute those
statistics if they are requested, regardless of whether or not they are meaningful. It
is up to you to determine if these measures are appropriate for your data. In
general, you should never use any of these statistics for nominal variables, and
should only use these statistics for continuous variables, and (with caution) for
ordinal variables .

3- Charts: Opens the Frequencies: Charts window, which contains various


graphical options. Options include bar charts, pie charts, and histograms. For
categorical variables, bar charts and pie charts are appropriate. Histograms should
only be used for continuous variables; they should not be used for ordinal
variables, and should never be used with nominal variables. Fig (42).
Fig(42): Frequencies Charts

4- Format: Opens the Frequencies: Format window, which contains options for
how to sort and organize the table output. Fig(43)

Fig(43): Frequencies Format Window

5- Display frequency tables: When checked, frequency tables will be printed.


(This box is checked by default.) If this check box is not checked, no frequency
tables will be produced, and the only output will come from supplementary options
from Statistics or Charts. For categorical variables, you will usually want to
leave this box checked.

Example: Summarizing a Categorical Variable

Using the sample dataset, let's a create a frequency table and a corresponding bar
and chart for the Marital Status Variables, and let's also request the Mode statistic
for this variable.
Running the Procedure ,,, Using the Frequencies Dialog Window

1. Open the Frequencies window (Analyze > Descriptive Statistics >


Frequencies) and double-click on variable Marital Status.
2. To request the mode statistic, click Statistics. Check the box next to Mode,
then click Continue.
3. To turn on the bar chart option, click Charts. Select the radio button for Bar
Charts. Then click Continue.
4. When finished, click OK. Look at Figs(44,45)

Fig (44): Frequencies, and statistics windows

Fig(45): Frequencies, and Charts Windows


How Output window appears?
Two tables appear in the output:

1- Statistics table; which reports the number of missing and non-missing observations in
the dataset, plus any requested statistics (Mode, in this example); look at Table (1)
2- The frequency table for variable Marital Status. The table title for the frequency table
is determined by the variable's label (or the variable name, if a label is not assigned).

Statistics

Table(1): Statistic Table


that represents missing
and non-missing values

N Valid 18

Missing 0

Mode 2

Here, the Statistics table shows that there are 18 valid and 0 missing values. It also
shows the Mode statistic: here, the mode value is "2", which is the numeric code
for the category (Married). Notice that the Mode statistic isn't displaying the value
labels, even though they have been assigned.

Table (2): The frequency table for Marital Status

Cumulative
Frequency Percent Valid Percent Percent

Valid Single 5 27.8 27.8 27.8

Married 10 55.6 55.6 83.3

divorce 3 16.7 16.7 100.0

Total 18 100.0 100.0


The frequency table contains four columns of summary measures, here, we will
explain just two.

 The Frequency column indicates how many observations fell into the given
category.
 The Percent column indicates the percentage of observations in that
category out of all observations.

The bar chart appears after the tables.

Here, we can see that:

 Married Patients comprised the largest group (about 10).


 There were approximately 5 patients who are single.
 Divorced patients were the smallest group (about 3).
Ex2: Example: Summarizing a Quantitative Variable

Using the sample dataset, let's a create Histogram chart for the Patient Age
Variable, and let's also request the Central Tendency and variation statistic for this
variable.

Running the Procedure ,,, Using the Frequencies Dialog Window

1. Open the Frequencies window (Analyze > Descriptive Statistics >


Frequencies) and double-click on variable Age.
2. To request the statistic, click Statistics. Check the box next to Mean,
Median, std., and Range, then click Continue.
3. To turn on the histogram chart option, click Charts. Select the radio button
for Histogram. Then click Continue.
4. When finished, click OK. Look at Figs(46,47).

Fig(46): Procedures of requesting statistics for quantitative variables


Fig(47): Fig(46): Procedures of requesting charts for quantitative variables

Output

1- Statistics Table
Statistics

Patient Age

N Valid 18

Missing 0

Mean 51.22

Median 54.00

Std. Deviation 14.477

Range 42

2- Histogram Chart
b- Crosstabs

To summarize a single categorical variable, we use frequency tables (as discussed


above). To summarize the relationship between two categorical variables, we use
a cross-tabulation (also called a contingency table). A cross-tabulation (or crosstab
for short) is a table that describes the number of times each of the possible category
combinations occurred in the data.

To create a crosstab, click Analyze > Descriptive Statistics > Crosstabs. Fig(47).

Fig(47): Creating crosstabs

After clicking on Crosstabs, the following window will appear. Fig (48).

Fig(48): crosstabs options window


Note : We will, in this class, focus on and explain just I,2, and 3 orders as
mentioned in Figure (38).

1- Row(s): One or more variables to use in the rows of the crosstab(s). You must
enter at least one Row variable.

2- Column(s): One or more variables to use in the columns of the crosstab(s). You
must enter at least one Column variable.

3- Cells : Opens the Crosstabs Cell Display window, that allow us to choose how to
display the crosstabs ( using count or percentages. And choose either row percents
or column percents). Look at fig (49).

Fig( 49): crosstabs Cell Display window

Example 1: Create crosstabs for Gender and Marital Status Variables:

The procedures to create crosstabs;

- Analyze > Descriptive Statistics > Crosstabs.


- Move variable “Gender” to the row, and Variable “Marital Status” to the
Column.
- Click on Cells button.
- From cell display window, check on count, observations, and check on Row
from percentages to represent row percents in the crosstabs table.
- Click continue , and then click Ok.
- Look at Fig(50). And follow the steps that shown in Red
Fig(50): steps to create crosstabs

Output Table:

Patient Gender * Patient Marital Status Crosstabs

Patient Marital Status

Single Married divorced Total

Patient Gender Male Count 3 3 2 8

% within Patient Gender 37.5% 37.5% 25.0% 100.0%

Female Count 2 7 1 10

% within Patient Gender 20.0% 70.0% 10.0% 100.0%

Total Count 5 10 3 18

% within Patient Gender 27.8% 55.6% 16.7% 100.0%

 Row variable: Gender (2 categories: male, female)


 Column variable: Marital Status (3 categories: Single, Married, and Divorced.
 Row percentage is displayed.
C- Compare Means

The Compare Means procedure is useful when you want to summarize and
compare differences in descriptive statistics across one or more factors, or
categorical variables.

Ex: let’s compare weight mean of two groups (male and female):

The procedures of Comparing weight Means are shown in figures( 51, 52 and 53)

Fig(51): Compare Means Window

Fig(52): Compare Means Window


Fig(53): Compare Means Window

Output of Compare Means of two Groups (Male and Female)

Case Processing Summary

Cases

Included Excluded Total

N Percent N Percent N Percent

Patient Weight * Patient


18 100.0% 0 .0% 18 100.0%
Gender

Report

Patient Weight

Patient
Gender Mean N Std. Deviation

Male 80.6037 8 18.15254

Female 79.9300 10 16.74721

Total 80.2294 18 16.86075

Good Luck ,, *_*

You might also like