Reputation: 11
In SPSS, I am attempting to use quartiles values of multiple variables to compute and form their respective new variables. E.g. There are five variables q1, q2, q3, q4, q5. I find out Tukey's Hinges Quartiles (Q1, Q2, Q3) using the syntax given later. The Q1 value needs to be used to compute another variable. e.g:
COMPUTE ProcessedQ1 = <Q1 value-how to find this value> * 3.
Similar process to be applied for Q2 and Q3.
Is there a way to use the Q1, Q2, and Q3 values from the output file (or if possible any other process) to compute into a new variable as I described above?
The Q1, Q2, Q3 are obtained from the following syntax from the output file.
EXAMINE VARIABLES=q1
/PLOT NONE
/PERCENTILES(5,10,25,50,75,90,95) HAVERAGE
/STATISTICS NONE
/MISSING LISTWISE
/NOTOTAL.
Upvotes: 1
Views: 71
Reputation: 11310
You can first get the values from the output into a new dataset using OMS
:
dataset name orig.
DATASET DECLARE MyPercentiles.
OMS /SELECT TABLES /IF COMMANDS=['Explore'] SUBTYPES=['Percentiles']
/DESTINATION FORMAT=SAV OUTFILE=MyPercentiles VIEWER=yes.
* this is your original syntax, you can run all your variables on this at the same time.
EXAMINE VARIABLES=q1 q2 q3
/PLOT NONE
/PERCENTILES(5,10,25,50,75,90,95) HAVERAGE
/STATISTICS NONE
/MISSING LISTWISE
/NOTOTAL.
omsend .
dataset activate MyPercentiles.
select if var1="Tukey's Hinges".
compute mtch=1.
sort cases by mtch var2.
CASESTOVARS /ID=mtch /index=var2 /drop Command_ Subtype_ Label_ Var1 @5 @10 @90 @95/sep="_".
dataset activate orig.
compute mtch=1.
match files /file=* /tab=MyPercentiles /by mtch/ drop mtch.
The syntax above goes all the way to add the new quartiles back to the original data, where you can work with them (they will be called @25_q1 ... @75_q3).
If all you want is a new dataset with the quartiles themselves you can stop at any point (either before or right after casestovars
).
Upvotes: 0