Hi,
I am working on hotel dataset and i want to find the price of both hotels charging for different customer_type. Here adr is Average Daily Rate as defined by dividing the sum of all lodging transactions by the total number of staying nights.
Hotel variable has 2 hotels which are city and resort hotel.
Customer_type= Transient,contract ,group.
I have used this code:
proc sgplot data=hotel.Hotel_bookings;
scatter x=customer_type y=adr/ group=hotel;
title'Does the hotel charges varied for different customer';
run;
The above output i got, but there the adr variable should be increasing by 100 starting from 0. Also the plotting is not clear.
Can anyone help how to correct this please..
Thanks
Start with
title'Do hotel charges vary for different customer types';
proc sgplot data=hotel.Hotel_bookings;
where adr < 1000;
vbox adr / category=customer group=hotel;
run;
The above output i got, but there the adr variable should be increasing by 100 starting from 0. Also the plotting is not clear.
Can anyone help how to correct this please..
Why should anything go from 100 to 0? Your data has to provide the X and Y values. If you don't have a 100 then you need to do something. The Y axis showing values to 6000 makes me suspect something wonky in your ADR calculation
If you want to see a distribution of values I would suggest a BOXPLOT instead of scatter.
Data is important when plotting something. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the <> icon or attached as text to show exactly what you have and that we can test code against.
Yes i agree with you @ballardw, boxplot would be better suitable .The reason i need adr in 100's is since it is hotel in europe the charge per day i want to show in 100's series.
While switching to boxplot, can you help how to change the adr variable in 100's rate please??
Thanks
@Amali6 wrote:
Yes i agree with you @ballardw, boxplot would be better suitable .The reason i need adr in 100's is since it is hotel in europe the charge per day i want to show in 100's series.
While switching to boxplot, can you help how to change the adr variable in 100's rate please??
Thanks
You will need to provide some data, preferably the before your current calculation of ADR.
Then show the code you currently used to create ADR.
Then provide the rules of what value would be "100". That sounds like there may be a "standardizing" involved but just saying 0 to 100 doesn't describe what is going on. If you want to place the percentile of a value as part of a group of values then say so.
One thing that brings a minor concern to the brief description of ADR you used is that longer stays might be biasing your data. I know that I see TV advertisements for hotel chains like "stay 4 nights and the 5th night is free". Or loyalty programs that will adjust prices based on number of stays in a period.
For many purposes I would look at the distribution with box plots before worrying about any shifting of values because that shows me more about the raw data without having to go into any odd algebra to discuss comparing values.
You have a significant outlier. If you remove your outlier your graphs will likely be better formatted by default.
You can control the axis using Xaxis or yAxis statement to control the values.
yaxis values = (0 to 1000 by 100);
Start with
title'Do hotel charges vary for different customer types';
proc sgplot data=hotel.Hotel_bookings;
where adr < 1000;
vbox adr / category=customer group=hotel;
run;
@Amali6 , Great! Please post the resulting graph for the benefit of members consulting this thread in the future.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: