# data on sub sandwiches # ------------------------------------------------------------------------------ # R code fat <- c(3,4,4,5,5,5,6,31,40) chol <- c(0,20,23,20,26,25,48,85,145) calories <- c(232,282,288,296,312,323,342,560,720) Subs <- data.frame(fat,chol,calories) rownames(Subs) <- c("Veggie","Turkey","Turkey+Ham","Ham","RoastBeef","ChickenBreast", "ChickenOriental","LoadedBurger","CheesyBurger") rm(fat,chol,calories) # fit a model to all of the data Subs.Fit <- lm(calories ~ fat + chol, data = Subs) summary(Subs.Fit) * ------------------------------------------------------------------------------ ; * SAS code ; data subs ; length name $ 15 ; input sandwich name $ fat cholest calories @@ ; label name = "Sandwich name" fat = "Total Fat (g)" cholest = "Cholesterol (mg)" calories = "Calories" ; cards ; 1 Veggie 3 0 232 2 Turkey 4 20 282 3 Turkey+Ham 4 23 288 4 Ham 5 20 296 5 RoastBeef 5 26 312 6 ChickenBreast 5 25 323 7 ChickenOriental 6 48 342 8 LoadedBurger 31 85 560 9 CheesyBurger 40 145 720 ; proc print ; run ; * Fit a model to all of the data ; proc reg data = subs ; model calories = fat cholest ; run ; quit ;