dm 'log;clear;output;clear;'; options ps=50 ls=70 pageno=1; goptions reset=global border ftext=swiss gunit=cm htext=0.4 htitle=0.5; goptions display noprompt; **********************************************************************; ** **; ** AUTHOR: Chris Bilder **; ** COURSE: STAT 873 **; ** DATE: 1-7-01 **; ** UPDATE: 8-22-03 **; ** PURPOSE: Read in the cereal data from an excel file and do some **; ** calculations for chapter 1 **; ** **; ** NOTES: **; ** **; **********************************************************************; title1 'Chris Bilder, STAT 873'; *Read in Excel file containing the cereal data'; * Note: The variable names are ID, shelf, cereal, size_g, sugar_g, fat_g, and sodium_mg; proc import out=set1 datafile= "c:\Chris\OSU\Stat5063\Chapter 1\cereal_data.xls" dbms=excel2000 replace; getnames=yes; run; *adjust for the serving size; data set2; set set1; sugar = sugar_g/size_g; fat = fat_g/size_g; sodium = sodium_mg/size_g; run; title2 'The cereal data set'; proc print data=set2; run; title2 'Find mean vector and covariance matrix'; proc princomp data=set2 covariance; var sugar fat sodium; run; title2 'Find mean vector and correlation matrix'; proc princomp data=set2; var sugar fat sodium; run; proc standard data=set2 out=stand mean=0 std=1; var sugar fat sodium; run; title2 'The standardized data'; proc print data=stand; var ID sugar fat sodium; run; quit;