GANESH MANDAPS IN INDIA: DATA VISUALIZATION AND ANALYSIS VIA PROC SQL | PROC SGPLOT | PROC MEANS | PROC PRINT
/*Creating A Dataset Of Ganesh Mandap In India*/
Step 1: create Ganesh Mandap dataset
options nocenter;
data ganesh_mandap;
length MandapType $15 Location $15 Material $15 Weather $10;
input MandapType $ Location $ Material $ Visitors Duration Cost Volunteers
Satisfaction EnvironmentalImpact SocialMedia Weather $;
datalines;
Traditional Pune Clay 5000 10 12000 50 8 3 450 Sunny
Ecofriendly Guwahati Bamboo 3500 7 8000 30 9 5 320 Rainy
Marble Chennai Marble 4500 9 25000 40 7 2 410 Sunny
Terracotta Kolkata Terracotta 3000 8 6000 25 8 4 180 Cloudy
Wooden Bengaluru Wood 4200 10 15000 45 9 3 375 Sunny
Glass Delhi Glass 6000 5 30000 60 6 1 900 Rainy
Papermache Ahmedabad Paper 2500 6 5000 20 7 5 150 Sunny
Sand Goa Sand 2700 4 4000 15 8 5 230 Sunny
Flower Kerala Flowers 3200 11 7000 35 10 2 260 Cloudy
Metal Jaipur Metal 2900 7 10000 28 7 3 190 Sunny
Fusion Hyderabad Glass/Wood 4800 8 18000 38 9 3 550 Sunny
;
run;
proc print data=ganesh_mandap;
title "Ganesh Mandap Data Overview";
run;
Output:
| Obs | MandapType | Location | Material | Weather | Visitors | Duration | Cost | Volunteers | Satisfaction | EnvironmentalImpact | SocialMedia |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Traditional | Pune | Clay | Sunny | 5000 | 10 | 12000 | 50 | 8 | 3 | 450 |
| 2 | Ecofriendly | Guwahati | Bamboo | Rainy | 3500 | 7 | 8000 | 30 | 9 | 5 | 320 |
| 3 | Marble | Chennai | Marble | Sunny | 4500 | 9 | 25000 | 40 | 7 | 2 | 410 |
| 4 | Terracotta | Kolkata | Terracotta | Cloudy | 3000 | 8 | 6000 | 25 | 8 | 4 | 180 |
| 5 | Wooden | Bengaluru | Wood | Sunny | 4200 | 10 | 15000 | 45 | 9 | 3 | 375 |
| 6 | Glass | Delhi | Glass | Rainy | 6000 | 5 | 30000 | 60 | 6 | 1 | 900 |
| 7 | Papermache | Ahmedabad | Paper | Sunny | 2500 | 6 | 5000 | 20 | 7 | 5 | 150 |
| 8 | Sand | Goa | Sand | Sunny | 2700 | 4 | 4000 | 15 | 8 | 5 | 230 |
| 9 | Flower | Kerala | Flowers | Cloudy | 3200 | 11 | 7000 | 35 | 10 | 2 | 260 |
| 10 | Metal | Jaipur | Metal | Sunny | 2900 | 7 | 10000 | 28 | 7 | 3 | 190 |
| 11 | Fusion | Hyderabad | Glass/Wood | Sunny | 4800 | 8 | 18000 | 38 | 9 | 3 | 550 |
Step 2: Frequency count of Mandap Types
proc freq data=ganesh_mandap;
tables MandapType / nocum nopercent;
title "Frequency of Different Mandap Types";
run;
Output:
The FREQ Procedure
| MandapType | Frequency |
|---|---|
| Ecofriendly | 1 |
| Flower | 1 |
| Fusion | 1 |
| Glass | 1 |
| Marble | 1 |
| Metal | 1 |
| Papermache | 1 |
| Sand | 1 |
| Terracotta | 1 |
| Traditional | 1 |
| Wooden | 1 |
Step 3: Descriptive statistics for Visitors & Cost
proc means data=ganesh_mandap mean median min max std;
var Visitors Cost;
title "Visitor Count & Decoration Cost Statistics";
run;
Output:
The MEANS Procedure
| Variable | Mean | Median | Minimum | Maximum | Std Dev |
|---|---|---|---|---|---|
Visitors Cost | 3845.45 12727.27 | 3500.00 10000.00 | 2500.00 4000.00 | 6000.00 30000.00 | 1127.27 8521.63 |
Step 4: Calculate average Satisfaction Score by Mandap Type using PROC SQL
proc sql;
title "Average Satisfaction Score by Mandap Type";
select MandapType, avg(Satisfaction) as AvgSatisfaction
from ganesh_mandap
group by MandapType
order by AvgSatisfaction desc;
quit;
Output:
| MandapType | AvgSatisfaction |
|---|---|
| Flower | 10 |
| Fusion | 9 |
| Wooden | 9 |
| Ecofriendly | 9 |
| Traditional | 8 |
| Terracotta | 8 |
| Sand | 8 |
| Papermache | 7 |
| Metal | 7 |
| Marble | 7 |
| Glass | 6 |
Step 5: Sort data by Visitors descending to find most popular Mandaps
proc sort data=ganesh_mandap out=sorted_visitors;
by descending Visitors;
run;
proc print data=sorted_visitors (obs=5);
title "Top 5 Mandaps by Visitor Count";
run;
Output:
| Obs | MandapType | Location | Material | Weather | Visitors | Duration | Cost | Volunteers | Satisfaction | EnvironmentalImpact | SocialMedia |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Glass | Delhi | Glass | Rainy | 6000 | 5 | 30000 | 60 | 6 | 1 | 900 |
| 2 | Traditional | Pune | Clay | Sunny | 5000 | 10 | 12000 | 50 | 8 | 3 | 450 |
| 3 | Fusion | Hyderabad | Glass/Wood | Sunny | 4800 | 8 | 18000 | 38 | 9 | 3 | 550 |
| 4 | Marble | Chennai | Marble | Sunny | 4500 | 9 | 25000 | 40 | 7 | 2 | 410 |
| 5 | Wooden | Bengaluru | Wood | Sunny | 4200 | 10 | 15000 | 45 | 9 | 3 | 375 |
Step 6: Creating Macro to dynamically generate summary report by any numeric variable
%macro summary_report(varlist);
%do i=1 %to %sysfunc(countw(&varlist));
%let var=%scan(&varlist, &i);
proc means data=ganesh_mandap mean median std min max;
var &var;
title "Summary Statistics for &var";
run;
%end;
%mend;
%summary_report(Visitors Cost Duration Volunteers);
Output:
The MEANS Procedure
| Analysis Variable : Visitors | ||||
|---|---|---|---|---|
| Mean | Median | Std Dev | Minimum | Maximum |
| 3845.45 | 3500.00 | 1127.27 | 2500.00 | 6000.00 |
The MEANS Procedure
| Analysis Variable : Cost | ||||
|---|---|---|---|---|
| Mean | Median | Std Dev | Minimum | Maximum |
| 12727.27 | 10000.00 | 8521.63 | 4000.00 | 30000.00 |
The MEANS Procedure
| Analysis Variable : Duration | ||||
|---|---|---|---|---|
| Mean | Median | Std Dev | Minimum | Maximum |
| 7.7272727 | 8.0000000 | 2.1950357 | 4.0000000 | 11.0000000 |
The MEANS Procedure
| Analysis Variable : Volunteers | ||||
|---|---|---|---|---|
| Mean | Median | Std Dev | Minimum | Maximum |
| 35.0909091 | 35.0000000 | 13.3525619 | 15.0000000 | 60.0000000 |
Step 7: Using PROC FORMAT to categorize Environmental Impact
proc format;
value envfmt
1 = 'Low Impact'
2 = 'Low Impact'
3 = 'Moderate Impact'
4 = 'High Impact'
5 = 'Very High Impact';
run;
proc freq data=ganesh_mandap;
tables EnvironmentalImpact / norow nocol;
format EnvironmentalImpact envfmt.;
title "Environmental Impact Categorization";
run;
Output:
The FREQ Procedure
| EnvironmentalImpact | Frequency | Percent | Cumulative Frequency | Cumulative Percent |
|---|---|---|---|---|
| Low Impact | 3 | 27.27 | 3 | 27.27 |
| Moderate Impact | 4 | 36.36 | 7 | 63.64 |
| High Impact | 1 | 9.09 | 8 | 72.73 |
| Very High Impact | 3 | 27.27 | 11 | 100.00 |
Step 8: Transpose dataset to see Visitors by Location
proc sort data=ganesh_mandap;
by MandapType;
run;
proc transpose data=ganesh_mandap out=visitors_by_location(drop=_Name_) prefix=Visitors_;
by MandapType;
id Location;
var Visitors;
run;
proc print data=visitors_by_location;
title "Visitors Transposed by Mandap Type and Location";
run;
Output:
| Obs | MandapType | Visitors_Guwahati | Visitors_Kerala | Visitors_Hyderabad | Visitors_Delhi | Visitors_Chennai | Visitors_Jaipur | Visitors_Ahmedabad | Visitors_Goa | Visitors_Kolkata | Visitors_Pune | Visitors_Bengaluru |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Ecofriendly | 3500 | . | . | . | . | . | . | . | . | . | . |
| 2 | Flower | . | 3200 | . | . | . | . | . | . | . | . | . |
| 3 | Fusion | . | . | 4800 | . | . | . | . | . | . | . | . |
| 4 | Glass | . | . | . | 6000 | . | . | . | . | . | . | . |
| 5 | Marble | . | . | . | . | 4500 | . | . | . | . | . | . |
| 6 | Metal | . | . | . | . | . | 2900 | . | . | . | . | . |
| 7 | Papermache | . | . | . | . | . | . | 2500 | . | . | . | . |
| 8 | Sand | . | . | . | . | . | . | . | 2700 | . | . | . |
| 9 | Terracotta | . | . | . | . | . | . | . | . | 3000 | . | . |
| 10 | Traditional | . | . | . | . | . | . | . | . | . | 5000 | . |
| 11 | Wooden | . | . | . | . | . | . | . | . | . | . | 4200 |
Step 9: Report combining multiple variables with PROC REPORT
proc report data=ganesh_mandap nowd;
columns MandapType Location Visitors Cost Satisfaction EnvironmentalImpact;
define MandapType / group;
define Location / group;
define Visitors / analysis sum;
define Cost / analysis mean format=dollar12.;
define Satisfaction / analysis mean;
define EnvironmentalImpact / format=envfmt.;
title "Ganesh Mandap Report: Visitor & Cost Summary";
run;
Output:
| MandapType | Location | Visitors | Cost | Satisfaction | EnvironmentalImpact |
|---|---|---|---|---|---|
| Ecofriendly | Guwahati | 3500 | $8,000 | 9 | Very High Impact |
| Flower | Kerala | 3200 | $7,000 | 10 | Low Impact |
| Fusion | Hyderabad | 4800 | $18,000 | 9 | Moderate Impact |
| Glass | Delhi | 6000 | $30,000 | 6 | Low Impact |
| Marble | Chennai | 4500 | $25,000 | 7 | Low Impact |
| Metal | Jaipur | 2900 | $10,000 | 7 | Moderate Impact |
| Papermache | Ahmedabad | 2500 | $5,000 | 7 | Very High Impact |
| Sand | Goa | 2700 | $4,000 | 8 | Very High Impact |
| Terracotta | Kolkata | 3000 | $6,000 | 8 | High Impact |
| Traditional | Pune | 5000 | $12,000 | 8 | Moderate Impact |
| Wooden | Bengaluru | 4200 | $15,000 | 9 | Moderate Impact |
Step 10: Visualizing Visitor Count across Mandap Types with PROC SGPLOT
proc sgplot data=ganesh_mandap;
vbar MandapType / response=Visitors datalabel;
title "Visitor Counts by Mandap Type";
run;
Output:
Step 11: Advanced PROC SQL Join - If we had a second dataset with volunteer details
data volunteers;
input Location $ Volunteers Available_Hours;
datalines;
Pune 50 340
Guwahati 30 180
Chennai 40 320
Kolkata 25 120
Bengaluru 45 360
Delhi 60 400
Ahmedabad 20 150
Goa 15 90
Kerala 35 280
Jaipur 28 210
Hyderabad 65 450
;
run;
proc print;run;
Output:
| Obs | Location | Volunteers | Available_Hours |
|---|---|---|---|
| 1 | Pune | 50 | 340 |
| 2 | Guwahati | 30 | 180 |
| 3 | Chennai | 40 | 320 |
| 4 | Kolkata | 25 | 120 |
| 5 | Bengalur | 45 | 360 |
| 6 | Delhi | 60 | 400 |
| 7 | Ahmedaba | 20 | 150 |
| 8 | Goa | 15 | 90 |
| 9 | Kerala | 35 | 280 |
| 10 | Jaipur | 28 | 210 |
| 11 | Hyderaba | 65 | 450 |
proc sql;
title "Join Ganesh Mandap with Volunteers Data for Analysis";
select a.Location, a.MandapType, a.Visitors, b.Volunteers, b.Available_Hours
from ganesh_mandap as a
inner join volunteers as b
on a.Location = b.Location
order by a.Visitors desc;
quit;
Output:
| Location | MandapType | Visitors | Volunteers | Available_Hours |
|---|---|---|---|---|
| Delhi | Glass | 6000 | 60 | 400 |
| Pune | Traditional | 5000 | 50 | 340 |
| Chennai | Marble | 4500 | 40 | 320 |
| Guwahati | Ecofriendly | 3500 | 30 | 180 |
| Kerala | Flower | 3200 | 35 | 280 |
| Kolkata | Terracotta | 3000 | 25 | 120 |
| Jaipur | Metal | 2900 | 28 | 210 |
| Goa | Sand | 2700 | 15 | 90 |
Step 12: Macro to filter mandaps with visitor count above a threshold
%macro filter_visitors(threshold=);
proc print data=ganesh_mandap;
where Visitors > &threshold;
title "Mandaps with Visitors Greater than &threshold";
run;
%mend;
%filter_visitors(threshold=4000);
| Obs | MandapType | Location | Material | Weather | Visitors | Duration | Cost | Volunteers | Satisfaction | EnvironmentalImpact | SocialMedia |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 3 | Fusion | Hyderabad | Glass/Wood | Sunny | 4800 | 8 | 18000 | 38 | 9 | 3 | 550 |
| 4 | Glass | Delhi | Glass | Rainy | 6000 | 5 | 30000 | 60 | 6 | 1 | 900 |
| 5 | Marble | Chennai | Marble | Sunny | 4500 | 9 | 25000 | 40 | 7 | 2 | 410 |
| 10 | Traditional | Pune | Clay | Sunny | 5000 | 10 | 12000 | 50 | 8 | 3 | 450 |
| 11 | Wooden | Bengaluru | Wood | Sunny | 4200 | 10 | 15000 | 45 | 9 | 3 | 375 |
No comments:
Post a Comment