120 likes | 130 Views
SPSS tips and tricks for the initiated. Ways of working. Use menus to run commands Use menus, paste commands, run Write commands, run Your main product: ”The Syntax File” !!. Viewer. Contains all output Show/hide or delete elements Double-click to edit element
E N D
Ways of working • Use menus to run commands • Use menus, paste commands, run • Write commands, run • Your main product: ”The Syntax File” !! H.S.
Viewer • Contains all output • Show/hide or delete elements • Double-click to edit element • Double-click on chart to start Chart Editor H.S.
Select and Filter Select if (age>50). Compute ff=(age>50). Filter by ff. … Filter off. Temporary Select if (age>50). command. H.S.
Compute and If If (age<=50) old=0. If (age>50) old=1. Compute old=(age>50). Comp oldMale=0. If (age>50 and sex=1) oldMale=1. Compute oldMale= (age>50 and sex=1). Compute id=$casenum. H.S.
Recode recode age (missing=sysmis) (lowest thru 29=1) (30 thru 39=2) (40 thru highest=3) into ageGr3. or comp ageGr3=1+(age>=30) +(age>=40). variable label ageGr3 ’Age in 3 groups’. value label ageGr3 1’29 years’ 2’30-39 years’ 3’40 years’. Rank age /ntiles(3) into ageGr3. Examine age by ageGr3 /plot=none. H.S.
Missing • System missing • Empty values are marked ”.” and called sysmis • User missing • Set to missing: missing age (999). • Set to value: missing age (). • Selection • Remove sysmis: select if (not sysmis(age)) • Remove all missing: select if (not missing(age)) H.S.
Set to missing • Make new variable compute miss=1. recode miss (1=sysmis). • Use the miss variable If (age>120) age=miss. H.S.
Functions that ignore missing • Sum function compute s1=a1+a2+a3. compute s1=Sum(a1,a2,a3). compute s1=Sum.2(a1,a2,a3). • Function list • Sum, Product, Min, Max, Mean H.S.
compute a=1. execute. compute b=a+1. freq b. Transformations pending Execute. • Example • Edit, Options, Data, • Calculate values immediately / before used H.S.
Long and wide data • Data, Restructure Long: Wide: H.S.
Variable order • Variable order and display • Edit, Options, General, • Alphabetical / File • Labels / Names • Save workfile save outfile= ’h:\Data\file1.sav’ /Keep=id age sex educ… H.S.