# R Script that reads the salary survey data, sets up the # dummy variables for educ, and creates a new data frame # with the original variables and dummy variables included. # Set working directory setwd("c:/datasets") # Read original data frame salary_survey1 <- read.table("salary-survey.txt", header=T) print(salary_survey1) # Set up dummy variables college_dummy <- as.numeric(salary_survey1$educ == 2) adv_deg_dummy <- as.numeric(salary_survey1$educ == 3) print(college_dummy) print(adv_deg_dummy) # Create new data frame salary_survey2 <- data.frame( exper = salary_survey1$exper, educ = salary_survey1$educ, college = college_dummy, adv_deg = adv_deg_dummy, mgt = salary_survey1$mgt, salary = salary_survey1$salary) print(salary_survey2) ---------------------------------------------------------- * SAS Script that reads the salary survey data, sets up the dummy variables for educ, and creates a new data frame with the original variables and dummy variables included; data salary_survey; infile "c:/datasets/salary-survey.txt" firstobs=6; input exper educ mgt salary; college = (educ = 2); adv_deg = (educ = 3); proc print; run; quit;