254.EXPLORATORY ANALYSIS OF DIFFERENT TYPES OF VACATION PLACES IN INDIA USING PROC PRINT | PROC SORT | PROC MEANS | PROC FREQ | PROC UNIVARIATE | PROC TRANSPOSE | PROC SGPLOT | PROC SQL | MACROS IN SAS

EXPLORATORY ANALYSIS OF DIFFERENT TYPES OF VACATION PLACES IN INDIA USING PROC PRINT | PROC SORT | PROC MEANS | PROC FREQ | PROC UNIVARIATE | PROC TRANSPOSE | PROC SGPLOT | PROC SQL | MACROS IN SAS

/*A real-world dataset of different types of vacation places across India*/


1. DATASET CREATION – VACATION_PLACES_INDIA

options nocenter;

data vacation_places_india;

    length Place_ID 8 Name $30 State $20 Region $15 

           Type $20 Ideal_Season $15 Popular_Activity $30 

           Avg_Cost_Per_Person 8 Rating 8;

    input Place_ID Name $ State $ Region $ Type $ 

          Ideal_Season $ Popular_Activity $ Avg_Cost_Per_Person Rating;

    datalines;

1 Manali Himachal_Pradesh North HillStation Summer Skiing 15000 4.7

2 Goa Goa West Beach Winter Party 18000 4.8

3 Jaipur Rajasthan West Heritage Winter Fort_Visit 14000 4.5

4 Darjeeling West_Bengal East HillStation Summer Toy_Train 12000 4.4

5 Ooty Tamil_Nadu South HillStation Summer Botanical_Garden 13000 4.6

6 Munnar Kerala South HillStation Monsoon Tea_Estate_Tour 14000 4.5

7 Udaipur Rajasthan West Heritage Winter Lake_Tour 16000 4.3

8 Rishikesh Uttarakhand North Spiritual Winter River_Rafting 9000 4.6

9 Andaman Islands UT Beach Winter Snorkeling 25000 4.8

10 Varanasi Uttar_Pradesh North Spiritual Winter Ganga_Aarti 11000 4.5

11 Leh Ladakh North Adventure Summer Biking 20000 4.9

12 Mysore Karnataka South Heritage Winter Palace_Visit 10000 4.2

13 Kochi Kerala South Backwater Monsoon Houseboat 17000 4.4

14 Shillong Meghalaya East HillStation Summer Waterfalls 15000 4.3

15 Hampi Karnataka South Heritage Winter Ruins_Tour 14000 4.1

16 Agra Uttar_Pradesh North Heritage Winter Taj_Mahal 12000 4.7

17 Kanyakumari Tamil_Nadu South Coastal Winter Sunrise_View 13000 4.2

18 Gulmarg Jammu_and_Kashmir North HillStation Winter Skiing 18000 4.8

19 Puri Odisha East Beach Winter Temple_Visit 10000 4.3

20 Mahabalipuram Tamil_Nadu South Heritage Winter Temple_Sculptures 11000 4.1

21 Auli Uttarakhand North Adventure Winter Skiing 16000 4.6

22 Rameswaram Tamil_Nadu South Spiritual Winter Temple_Tour 10000 4.4

23 Khajuraho Madhya_Pradesh Central Heritage Winter Erotic_Sculptures 14000 4.0

24 Sikkim Sikkim East HillStation Summer Trekking 17000 4.5

25 Mount_Abu Rajasthan West HillStation Summer Lake_Boating 12000 4.2

26 Lonavala Maharashtra West HillStation Monsoon Nature_Walk 9000 4.1

27 Coorg Karnataka South HillStation Monsoon Coffee_Plantation 13000 4.3

;

run;

proc print;run;

Output:

ObsPlace_IDNameStateRegionTypeIdeal_SeasonPopular_ActivityAvg_Cost_Per_PersonRating
11ManaliHimachal_PradeshNorthHillStationSummerSkiing150004.7
22GoaGoaWestBeachWinterParty180004.8
33JaipurRajasthanWestHeritageWinterFort_Visit140004.5
44DarjeelingWest_BengalEastHillStationSummerToy_Train120004.4
55OotyTamil_NaduSouthHillStationSummerBotanical_Garden130004.6
66MunnarKeralaSouthHillStationMonsoonTea_Estate_Tour140004.5
77UdaipurRajasthanWestHeritageWinterLake_Tour160004.3
88RishikeshUttarakhandNorthSpiritualWinterRiver_Rafting90004.6
99AndamanIslandsUTBeachWinterSnorkeling250004.8
1010VaranasiUttar_PradeshNorthSpiritualWinterGanga_Aarti110004.5
1111LehLadakhNorthAdventureSummerBiking200004.9
1212MysoreKarnatakaSouthHeritageWinterPalace_Visit100004.2
1313KochiKeralaSouthBackwaterMonsoonHouseboat170004.4
1414ShillongMeghalayaEastHillStationSummerWaterfalls150004.3
1515HampiKarnatakaSouthHeritageWinterRuins_Tour140004.1
1616AgraUttar_PradeshNorthHeritageWinterTaj_Mahal120004.7
1717KanyakumariTamil_NaduSouthCoastalWinterSunrise_View130004.2
1818GulmargJammu_and_KashmirNorthHillStationWinterSkiing180004.8
1919PuriOdishaEastBeachWinterTemple_Visit100004.3
2020MahabalipuramTamil_NaduSouthHeritageWinterTemple_Sculptures110004.1
2121AuliUttarakhandNorthAdventureWinterSkiing160004.6
2222RameswaramTamil_NaduSouthSpiritualWinterTemple_Tour100004.4
2323KhajurahoMadhya_PradeshCentralHeritageWinterErotic_Sculptures140004.0
2424SikkimSikkimEastHillStationSummerTrekking170004.5
2525Mount_AbuRajasthanWestHillStationSummerLake_Boating120004.2
2626LonavalaMaharashtraWestHillStationMonsoonNature_Walk90004.1
2727CoorgKarnatakaSouthHillStationMonsoonCoffee_Plantation130004.3


2. PROC PRINT – To display the entire dataset

Purpose: To print and display all vacation place records 


proc print data=vacation_places_india;

    title "All Vacation Places in India";

run;

Output:

All Vacation Places in India

ObsPlace_IDNameStateRegionTypeIdeal_SeasonPopular_ActivityAvg_Cost_Per_PersonRating
11ManaliHimachal_PradeshNorthHillStationSummerSkiing150004.7
22GoaGoaWestBeachWinterParty180004.8
33JaipurRajasthanWestHeritageWinterFort_Visit140004.5
44DarjeelingWest_BengalEastHillStationSummerToy_Train120004.4
55OotyTamil_NaduSouthHillStationSummerBotanical_Garden130004.6
66MunnarKeralaSouthHillStationMonsoonTea_Estate_Tour140004.5
77UdaipurRajasthanWestHeritageWinterLake_Tour160004.3
88RishikeshUttarakhandNorthSpiritualWinterRiver_Rafting90004.6
99AndamanIslandsUTBeachWinterSnorkeling250004.8
1010VaranasiUttar_PradeshNorthSpiritualWinterGanga_Aarti110004.5
1111LehLadakhNorthAdventureSummerBiking200004.9
1212MysoreKarnatakaSouthHeritageWinterPalace_Visit100004.2
1313KochiKeralaSouthBackwaterMonsoonHouseboat170004.4
1414ShillongMeghalayaEastHillStationSummerWaterfalls150004.3
1515HampiKarnatakaSouthHeritageWinterRuins_Tour140004.1
1616AgraUttar_PradeshNorthHeritageWinterTaj_Mahal120004.7
1717KanyakumariTamil_NaduSouthCoastalWinterSunrise_View130004.2
1818GulmargJammu_and_KashmirNorthHillStationWinterSkiing180004.8
1919PuriOdishaEastBeachWinterTemple_Visit100004.3
2020MahabalipuramTamil_NaduSouthHeritageWinterTemple_Sculptures110004.1
2121AuliUttarakhandNorthAdventureWinterSkiing160004.6
2222RameswaramTamil_NaduSouthSpiritualWinterTemple_Tour100004.4
2323KhajurahoMadhya_PradeshCentralHeritageWinterErotic_Sculptures140004.0
2424SikkimSikkimEastHillStationSummerTrekking170004.5
2525Mount_AbuRajasthanWestHillStationSummerLake_Boating120004.2
2626LonavalaMaharashtraWestHillStationMonsoonNature_Walk90004.1
2727CoorgKarnatakaSouthHillStationMonsoonCoffee_Plantation130004.3

3. PROC SORT – Sort places by cost

Purpose: To sort vacation places by highest to lowest average cost 


proc sort data=vacation_places_india out=sorted_by_cost;

    by descending Avg_Cost_Per_Person;

run;

proc print data = sorted_by_cost(obs=10);

run;

Output:

ObsPlace_IDNameStateRegionTypeIdeal_SeasonPopular_ActivityAvg_Cost_Per_PersonRating
19AndamanIslandsUTBeachWinterSnorkeling250004.8
211LehLadakhNorthAdventureSummerBiking200004.9
32GoaGoaWestBeachWinterParty180004.8
418GulmargJammu_and_KashmirNorthHillStationWinterSkiing180004.8
513KochiKeralaSouthBackwaterMonsoonHouseboat170004.4
624SikkimSikkimEastHillStationSummerTrekking170004.5
77UdaipurRajasthanWestHeritageWinterLake_Tour160004.3
821AuliUttarakhandNorthAdventureWinterSkiing160004.6
91ManaliHimachal_PradeshNorthHillStationSummerSkiing150004.7
1014ShillongMeghalayaEastHillStationSummerWaterfalls150004.3


4. PROC MEANS – Average cost and rating

Purpose: To find mean, min, and max values for cost and rating 


proc means data=vacation_places_india mean min max;

    var Avg_Cost_Per_Person Rating;

run;

Output:

The MEANS Procedure

VariableMeanMinimumMaximum
Avg_Cost_Per_Person
Rating
14000.00
4.4370370
9000.00
4.0000000
25000.00
4.9000000

5. PROC FREQ – Frequency of vacation types

Purpose: To calculate frequency of each vacation type (e.g., HillStation, Heritage) 


proc freq data=vacation_places_india;

    tables Type;

run;

Output:

The FREQ Procedure

TypeFrequencyPercentCumulative
Frequency
Cumulative
Percent
Adventure27.4127.41
Backwater13.70311.11
Beach311.11622.22
Coastal13.70725.93
Heritage725.931451.85
HillStation1037.042488.89
Spiritual311.1127100.00

6. PROC UNIVARIATE – Distribution of ratings

Purpose: To analyze the distribution and shape of the Rating variable 


proc univariate data=vacation_places_india;

    var Rating;

run;

Output:

The UNIVARIATE Procedure

Variable: Rating

Moments
N27Sum Weights27
Mean4.43703704Sum Observations119.8
Std Deviation0.24984326Variance0.06242165
Skewness0.11798908Kurtosis-0.9444171
Uncorrected SS533.18Corrected SS1.62296296
Coeff Variation5.63085802Std Error Mean0.04808236
Basic Statistical Measures
LocationVariability
Mean4.437037Std Deviation0.24984
Median4.400000Variance0.06242
Mode4.300000Range0.90000
  Interquartile Range0.40000

Note: The mode displayed is the smallest of 2 modes with a count of 4.

Tests for Location: Mu0=0
TestStatisticp Value
Student's tt92.27994Pr > |t|<.0001
SignM13.5Pr >= |M|<.0001
Signed RankS189Pr >= |S|<.0001
Quantiles (Definition 5)
LevelQuantile
100% Max4.9
99%4.9
95%4.8
90%4.8
75% Q34.6
50% Median4.4
25% Q14.2
10%4.1
5%4.1
1%4.0
0% Min4.0
Extreme Observations
LowestHighest
ValueObsValueObs
4.0234.716
4.1264.82
4.1204.89
4.1154.818
4.2254.911

7. PROC TRANSPOSE – Transpose data for comparison

Purpose: To restructure the dataset for comparing ratings across regions 


proc transpose data=vacation_places_india out=transposed_rating;

    id Region;

    var Rating;

    by Type;

run;

proc print;run;

Output:

ObsType_NAME_NorthWestEastSouthUTCentral
1HillStationRating4.7.....
2BeachRating.4.8....
3HeritageRating.4.5....
4HeritageRating.4.3....
5SpiritualRating4.6.....
6BeachRating....4.8.
7SpiritualRating4.5.....
8AdventureRating4.9.....
9HeritageRating...4.2..
10BackwaterRating...4.4..
11HillStationRating..4.3...
12HeritageRating4.7..4.1..
13CoastalRating...4.2..
14HillStationRating4.8.....
15BeachRating..4.3...
16HeritageRating...4.1..
17AdventureRating4.6.....
18SpiritualRating...4.4..
19HeritageRating.....4


8. PROC SGPLOT – Plot Cost vs Rating

Purpose: To visualize the relationship between cost and rating grouped by vacation type 


proc sgplot data=vacation_places_india;

    scatter x=Avg_Cost_Per_Person y=Rating / group=Type;

    title "Scatter Plot of Cost vs Rating by Vacation Type";

run;

Output:



9. PROC SQL – Multiple tasks

a. Top 5 rated vacation places

 Purpose: To get top 5 vacation places by rating using SQL 


proc sql outobs=5;

    select Name, State, Type, Rating 

    from vacation_places_india

    order by Rating desc;

quit;

Output:

NameStateTypeRating
LehLadakhAdventure4.9
GoaGoaBeach4.8
AndamanIslandsBeach4.8
GulmargJammu_and_KashmirHillStation4.8
ManaliHimachal_PradeshHillStation4.7


b. Count places per state

 Purpose: To count how many vacation spots exist per state 


proc sql;

    select State, count(*) as Place_Count

    from vacation_places_india

    group by State

    order by Place_Count desc;

quit;

Output:

StatePlace_Count
Tamil_Nadu4
Karnataka3
Rajasthan3
Kerala2
Uttar_Pradesh2
Uttarakhand2
Ladakh1
Islands1
Sikkim1
Odisha1
Meghalaya1
Maharashtra1
Goa1
Himachal_Pradesh1
Jammu_and_Kashmir1
Madhya_Pradesh1
West_Bengal1

10. MACROS – Automate analysis

a. Macro to display top N vacation places by rating

 Purpose: Reusable macro to get top N vacation spots by rating 


%macro top_places(n=5);

    proc sql outobs=&n;

        title "Top &n Rated Vacation Places";

        select Name, State, Rating

        from vacation_places_india

        order by Rating desc;

    quit;

%mend;


%top_places(n=10);

Output:

Top 10 Rated Vacation Places

NameStateRating
LehLadakh4.9
GoaGoa4.8
AndamanIslands4.8
GulmargJammu_and_Kashmir4.8
ManaliHimachal_Pradesh4.7
AgraUttar_Pradesh4.7
OotyTamil_Nadu4.6
AuliUttarakhand4.6
RishikeshUttarakhand4.6
SikkimSikkim4.5

b. Macro to show places by type

 Purpose: To filter and print vacation places of a specific type 


%macro show_by_type(place_type);

    proc print data=vacation_places_india;

        where Type="&place_type";

        title "Places of Type: &place_type";

    run;

%mend;


%show_by_type(HillStation);

Output:

Places of Type: HillStation

ObsPlace_IDNameStateRegionTypeIdeal_SeasonPopular_ActivityAvg_Cost_Per_PersonRating
11ManaliHimachal_PradeshNorthHillStationSummerSkiing150004.7
44DarjeelingWest_BengalEastHillStationSummerToy_Train120004.4
55OotyTamil_NaduSouthHillStationSummerBotanical_Garden130004.6
66MunnarKeralaSouthHillStationMonsoonTea_Estate_Tour140004.5
1414ShillongMeghalayaEastHillStationSummerWaterfalls150004.3
1818GulmargJammu_and_KashmirNorthHillStationWinterSkiing180004.8
2424SikkimSikkimEastHillStationSummerTrekking170004.5
2525Mount_AbuRajasthanWestHillStationSummerLake_Boating120004.2
2626LonavalaMaharashtraWestHillStationMonsoonNature_Walk90004.1
2727CoorgKarnatakaSouthHillStationMonsoonCoffee_Plantation130004.3

%show_by_type(Heritage);

Output:

Places of Type: Heritage

ObsPlace_IDNameStateRegionTypeIdeal_SeasonPopular_ActivityAvg_Cost_Per_PersonRating
33JaipurRajasthanWestHeritageWinterFort_Visit140004.5
77UdaipurRajasthanWestHeritageWinterLake_Tour160004.3
1212MysoreKarnatakaSouthHeritageWinterPalace_Visit100004.2
1515HampiKarnatakaSouthHeritageWinterRuins_Tour140004.1
1616AgraUttar_PradeshNorthHeritageWinterTaj_Mahal120004.7
2020MahabalipuramTamil_NaduSouthHeritageWinterTemple_Sculptures110004.1
2323KhajurahoMadhya_PradeshCentralHeritageWinterErotic_Sculptures140004.0




--- FOLLOW OUR BLOG FOR MORE INFORMATION.
--->PLEASE DO COMMENTS AND SHARE OUR BLOG.

PLEASE FOLLOW OUR TELEGRAM CHANNEL CLICK HERE

PLEASE FOLLOW OUR FACEBOOK PAGE  CLICK HERE

PLEASE FOLLOW OUR INSTAGRAM PAGE CLICK HERE


Comments

Popular posts from this blog

409.Can We Build a Reliable Emergency Services Analytics & Fraud Detection System in SAS While Identifying and Fixing Intentional Errors?

397.If a satellite has excellent signal strength but very high latency, can it still deliver good quality communication? Why or why not?A Sas Study

401.How Efficient Are Global Data Centers? A Complete SAS Analytics Study