* Please note that two tables are needed to calculate the percent of vehicles valued at $1
* The first table shows the number of vehicles (automobiles, buses, other motor vehicles, recreational vehicles, and trucks) in your data set
use all.
COMPUTE filter_$=(p_desc = '03' | p_desc = '05' | p_desc = '24' | p_desc =
'28' | p_desc = '37').
VARIABLE LABEL filter_$ "filter (FILTER)".
VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
FORMAT filter_$ (f1.0).
FILTER BY filter_$.
EXECUTE .
FREQUENCIES
VARIABLES=p_desc
/ORDER= ANALYSIS .
* The second table selects all vehicles with a value of exactly $1 and creates a table
USE ALL.
COMPUTE filter_$=((p_desc = '03' | p_desc = '05' | p_desc = '24' | p_desc =
'28' | p_desc = '37') & p_valu <= 10).
VARIABLE LABEL filter_$ "(p_desc = '03' | p_desc = '05' | p_desc = '24' |"+
" p_desc = '28' | p_desc = '37') & p_valu <= 10 (FILTER)".
VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
FORMAT filter_$ (f1.0).
FILTER BY filter_$.
EXECUTE .
FREQUENCIES
VARIABLES=p_valu
/ORDER= ANALYSIS .
* To determine the percentage of automobiles with the value of $1, divide the number created
* in the second table (the number of cars with valued at $1) by the total number of automobiles
* (the number produced in the first table)