BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Amali6
Quartz | Level 8

Amali6_0-1589394354906.png

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

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

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;
PG

View solution in original post

8 REPLIES 8
ballardw
Super User

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.

Amali6
Quartz | Level 8

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

ballardw
Super User

@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.

Reeza
Super User

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);
PGStats
Opal | Level 21

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;
PG
Amali6
Quartz | Level 8
Thank you i got the output what i need.
PGStats
Opal | Level 21

@Amali6 ,  Great! Please post the resulting graph for the benefit of members consulting this thread in the future.

PG

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 8 replies
  • 777 views
  • 3 likes
  • 4 in conversation