Question: SAS Code Question: Given Vegas_edit.dat dataset includes quantitative and categorical featured online reviews from 21 hotels located in Las Vegas Strip, extracted from TripAdvisor. The

SAS Code Question:

Given Vegas_edit.dat dataset includes quantitative and categorical featured online reviews

from 21 hotels located in Las Vegas Strip, extracted from TripAdvisor. The hotel names are

blinded as 1 to 21 under variable name. Write SAS code to read the dataset into SAS from

directory 'C:\Users\your student ID', use reference filename as "vegas".

The dataset should have 444 records and 21 variables namely: country, review, hotel_review,

help_vote, score, stay, type, pool, gym, tennis, spa, casino, internet, name, stars, rooms, user,

member, date, month, and weekday. Follow step (i) to step (vi) write comments in your code

to indicate which part you are doing and then answer Questions (1) to (4).

(i) Subset the dataset as vegas_new for variable type 'Couples' under SET statement and use vegas_new for the following part (ii) to (vi).

(ii) Recode variable date by subtracting 21,916, then use format so that value 21511 will display as 23/11/2018.

(iii) Create new variable week to indicate 'weekday' or 'weekend' from variable weekday

(contain 'Mon' to 'Sun') using IF-THEN/ELSE statement.

(iv) Create new variable season as 'Spring', 'Summer', 'Autumn', and 'Winter' from variable

stay for period between 'Mar-May', 'Jun-Aug', 'Sep-Nov', and 'Dec-Feb' using SELECT

group.

(v) A traveler is interested in facilities provided by the hotels which can be indicated by 6

variables namely pool, gym, tennis, spa, casino, and internet. Create new array facility 1 -

6 and variables f1 - f6 by recode 'yes' as '1' and 'no' as '0', then create new variable

SumFac to calculate the total sum of facilities score.

(vi) Drop unwanted variables and keep variables country, review, hotel_review, help_vote,

score, type, name, date, week, season, f1 - f6, and SumFac.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!