* Univar.sps. * Sample SPSS descriptive statistics example. Replicates examples in handout. * This program is really quite short, but these painstakingly detailed * comment lines stretch it out. Comment lines are very handy though * if you are ever trying to figure out why you did something the way you did. * Also, while I am giving you this program, this could all easily be done * interactively using SPSS Menus. In effect, SPSS will generate most * of this syntax for you. * First, enter the data. Normally I would create a separate data file, but for * now I will enter the data directly into the program using the * data list, begin data and end data commands. data list free / X. begin data. 100 150 200 250 250 250 250 325 325 400 end data. * The formats command tells SPSS that X is measured in dollars. * Not essential, but it helps make the display easier to read. This could * also be done using the SPSS Data Editor. The Var Labels Command * will also make the output easier to read. Formats X (dollar8). Var Labels X "Weekly Income". * Next, run the frequencies command, indicating what stats I want. * I used SPSS menus to generate the syntax for this command, but it * could also be typed in directly. FREQUENCIES VARIABLES=x /STATISTICS=STDDEV VARIANCE MEAN MEDIAN MODE SUM /ORDER= ANALYSIS . * In the output, notice that the variance and SD are bigger than what I had in * my example. * This is because SPSS assumes we are analyzing a sample, whereas * in the the example I stated we had the entire population, * hence SPSS uses a slightly different formula for its calculations. The * difference between sample estimates and population parameters * will be discussed in class. * Now, here is how to run the problem when the data are already grouped * in a frequency distribution. * The variable WGT indicates how often the value occurs in the data. data list free / X WGT. begin data. 100 1 150 1 200 1 250 4 325 2 400 1 end data. Formats X (dollar8). Var Labels X "Weekly Income"/ Wgt "Weighting Var". * The Weight command causes cases to be weighted by the # of times * the value occurs. Weight by Wgt. * Now just run the frequencies again. FREQUENCIES VARIABLES=x /STATISTICS=STDDEV VARIANCE MEAN MEDIAN MODE SUM /ORDER= ANALYSIS .