ST500 Third Session _sas syntax + assignment {remember: man sas>f1} /*coment is listed here */ To execute: sas command & This creates command.log and command.lst as default file names. The '&' at the end of the command line means run the command line in 'background'. _ph(phone book @ CSU) _netscapei or lynx: home-page for st500 http://www.stat.colostate.edu/~zumbrunn/St500/ _spss commands:syntax + examples {remember: man spss>f1} COMMENT 'comment is listed here' To execute: spss -m command>command.out & spss -m -s1m command>command.out & (if spss says it needs more memory) To read the data file for assignment 1 (b): data list file='assign1.dat' list/ name (a10) sex (a1) height weight age {NOTE: when you indent too far missing values weight(-1) with vi, it inserts 'tabs' that comment note the missing value statement above spss does NOT like on your list cases continuation lines where it is frequencies variables=name to age looking for a blank!} sort cases by sex split file by sex descriptive name to age/statistics save outfile=sclass select if sex='m' save outfile=smale get file=sclass select if sex='f' save outfile=sfemale add files file=smale/file=sfemale ... ... compute Iwt=lg10(weight) examine variables= height to Iwt / plot=stemleaf npplot boxplot ... ... ST500 Assignment 1 (b) - spss To execute SPSS with a control file: spss -m control>control.out& NOTE: Since we are running spss in 'batch' mode, there are no 'periods' required at the end of each statement. IF we were to run interactively a 'period' is required to end each statement! (e.g. SAVE OUTFILE=SMALE would need to be SAVE OUTFILE=SMALE.) You may check the ../assign/a1b file to get additional 'help'! The following tasks should be done with SPSS using the assign1.dat data file. You need email to me (st500in1) the (1)control statements (2) control.out file before the beginning of class on Jan 8 1. Read assign1.dat into SPSS then list it. (DATA LIST FILE='..'/.. \ LIST CASES \ EXECUTE) 2. Do a frequency distribution of all data fields. (FREQUENCIES ..) The negative value for weight should be 'missing' (MISSING VALUES ..) 3. Compute means/minimums/maximums of height,weight and age for sex (m and f) separately. (SORT CASES BY SEX \ SPLIT FILE BY SEX \ DESCRIPTIVE ..) 4. Create two SPSS data files: one with m and one with f. (SAVE OUTFILE=SCLASS \ SELECT IF SEX='m' \ SAVE OUTFILE=SMALE \ GETFILE=SCLASS \ SELECT IF ..\ SAVE OUTFILE=..) 5. Recombine the two files into one file and print. (ADD FILES FILE=SMALE/FILE=SFEMALE \ LIST CASES \ EXECUTE) 6. Sort the file by name within sex, and print. (SORT CASES BY .... \ LIST CASES \ EXECUTE) 7. Plot weight against height and age, using two symbols on the plot to indicate sex. (PLOT PLOT=WEIGHT WITH .... BY .. 8. compute LOG10 of weight (Iwt), then plot Iwt against age with symbols for sex as in 7. (COMPUTE Iwt=lg10(weight) \ PLOT PLOT=..) 9. Use EXAMINE to get stem + Leaf plot, boxplot and normal probability plot of weight, height, and Iwt. (EXAMINE VARIABLES= HEIGHT TO LWT /PLOT=STEMLEAF NPPLOT BOXPLOT) 10. SPSS can generate data, but it's a little 'awkward'. INPUT PROGRAM LOOP #I=1 to 200 COMPUTE A=NORMAL(1) COMPUTE B=A*.2+1 COMPUTE C=B*B COMPUTE D=10**B END CASE END LOOP END FILE END INPUT PROGRAM EXAMINE VARIABLES=A TO D/PLOT=STEMLEAF NPPLOT BOXPLOT