INDIAN SAREES ANALYTICS USING PROC PRINT | PROC SORT | PROC FREQ | PROC MEANS | PROC SQL | AND MACROS FOR DISCOUNT, PRODUCTION TIME, REVIEWS, PRICE, AND POPULARITY REPORTS ACROSS STATES
1. CREATE BASE DATASET: INDIAN SAREES INFORMATION
options nocenter;
data work.Indian_Sarees;
input SareeID $ SareeName:$15. State:$15. Fabric $ Color:$12. Price Popularity $;
datalines;
S001 Banarasi UttarPradesh Silk Red 8500 High
S002 Kanjeevaram TamilNadu Silk Gold 12000 VeryHigh
S003 Chanderi MadhyaPradesh Cotton Pink 4500 Medium
S004 Paithani Maharashtra Silk Green 10000 High
S005 Sambalpuri Odisha Cotton Blue 5500 Medium
S006 Pochampally Telangana Ikat Yellow 7500 High
S007 Muga Assam Silk Beige 9500 High
S008 KotaDoria Rajasthan Cotton White 4200 Medium
S009 Kasavu Kerala Cotton Cream 6000 High
S010 Patola Gujarat Silk Multicolor 15000 VeryHigh
S011 Baluchari WestBengal Silk Maroon 9000 High
S012 Narayanpet Telangana Cotton Orange 5000 Medium
;
run;
proc print data=work.Indian_Sarees;
title "ORIGINAL INDIAN SAREES DATASET";
run;
OUTPUT:
| Obs | SareeID | SareeName | State | Fabric | Color | Price | Popularity |
|---|---|---|---|---|---|---|---|
| 1 | S001 | Banarasi | UttarPradesh | Silk | Red | 8500 | High |
| 2 | S002 | Kanjeevaram | TamilNadu | Silk | Gold | 12000 | VeryHigh |
| 3 | S003 | Chanderi | MadhyaPradesh | Cotton | Pink | 4500 | Medium |
| 4 | S004 | Paithani | Maharashtra | Silk | Green | 10000 | High |
| 5 | S005 | Sambalpuri | Odisha | Cotton | Blue | 5500 | Medium |
| 6 | S006 | Pochampally | Telangana | Ikat | Yellow | 7500 | High |
| 7 | S007 | Muga | Assam | Silk | Beige | 9500 | High |
| 8 | S008 | KotaDoria | Rajasthan | Cotton | White | 4200 | Medium |
| 9 | S009 | Kasavu | Kerala | Cotton | Cream | 6000 | High |
| 10 | S010 | Patola | Gujarat | Silk | Multicolor | 15000 | VeryHigh |
| 11 | S011 | Baluchari | WestBengal | Silk | Maroon | 9000 | High |
| 12 | S012 | Narayanpet | Telangana | Cotton | Orange | 5000 | Medium |
2. ADD FLAG VARIABLES (DISCOUNT, PRODUCTION TIME, REVIEWS)
data work.Saree_Flag;
set work.Indian_Sarees;
array Saree_Flag[3] Saree_Discount Production_Time_Days Online_Reviews;
do i = 1 to dim(Saree_Flag);
Saree_Flag[i] = 0;
end;
/* --- Discounts Based on Fabric Type --- */
select (upcase(strip(Fabric)));
when ('SILK') Saree_Discount = 15;
when ('COTTON') Saree_Discount = 12;
when ('IKAT') Saree_Discount = 18;
otherwise Saree_Discount = 10;
end;
/* --- Production Time (in Days) --- */
select (upcase(strip(Fabric)));
when ('SILK') Production_Time_Days = 25;
when ('COTTON') Production_Time_Days = 40;
when ('IKAT') Production_Time_Days = 60;
otherwise Production_Time_Days = 30;
end;
/* --- Online Reviews (Out of 10) --- */
select (upcase(strip(Fabric)));
when ('SILK') Online_Reviews = 6.2;
when ('COTTON') Online_Reviews = 8.5;
when ('IKAT') Online_Reviews = 8.2;
otherwise Online_Reviews = 7.0;
end;
drop i;
run;
proc print data=work.saree_flag;
title "INDIAN SAREES WITH DISCOUNT, PRODUCTION TIME AND REVIEWS";
run;
OUTPUT:
| Obs | SareeID | SareeName | State | Fabric | Color | Price | Popularity | Saree_Discount | Production_Time_Days | Online_Reviews |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | S001 | Banarasi | UttarPradesh | Silk | Red | 8500 | High | 15 | 25 | 6.2 |
| 2 | S002 | Kanjeevaram | TamilNadu | Silk | Gold | 12000 | VeryHigh | 15 | 25 | 6.2 |
| 3 | S003 | Chanderi | MadhyaPradesh | Cotton | Pink | 4500 | Medium | 12 | 40 | 8.5 |
| 4 | S004 | Paithani | Maharashtra | Silk | Green | 10000 | High | 15 | 25 | 6.2 |
| 5 | S005 | Sambalpuri | Odisha | Cotton | Blue | 5500 | Medium | 12 | 40 | 8.5 |
| 6 | S006 | Pochampally | Telangana | Ikat | Yellow | 7500 | High | 18 | 60 | 8.2 |
| 7 | S007 | Muga | Assam | Silk | Beige | 9500 | High | 15 | 25 | 6.2 |
| 8 | S008 | KotaDoria | Rajasthan | Cotton | White | 4200 | Medium | 12 | 40 | 8.5 |
| 9 | S009 | Kasavu | Kerala | Cotton | Cream | 6000 | High | 12 | 40 | 8.5 |
| 10 | S010 | Patola | Gujarat | Silk | Multicolor | 15000 | VeryHigh | 15 | 25 | 6.2 |
| 11 | S011 | Baluchari | WestBengal | Silk | Maroon | 9000 | High | 15 | 25 | 6.2 |
| 12 | S012 | Narayanpet | Telangana | Cotton | Orange | 5000 | Medium | 12 | 40 | 8.5 |
3. APPLY LABELS TO VARIABLES FOR BETTER DISPLAY
proc print data=work.Indian_Sarees label;
label SareeID = "Saree ID"
SareeName = "Saree Name"
State = "Region"
Fabric = "Fabric Material"
Color = "Fabric Colour"
Price = "Price (INR)";
title "LABELED VERSION OF INDIAN SAREES DATASET";
run;
OUTPUT:
| Obs | Saree ID | Saree Name | Region | Fabric Material | Fabric Colour | Price (INR) | Popularity |
|---|---|---|---|---|---|---|---|
| 1 | S001 | Banarasi | UttarPradesh | Silk | Red | 8500 | High |
| 2 | S002 | Kanjeevaram | TamilNadu | Silk | Gold | 12000 | VeryHigh |
| 3 | S003 | Chanderi | MadhyaPradesh | Cotton | Pink | 4500 | Medium |
| 4 | S004 | Paithani | Maharashtra | Silk | Green | 10000 | High |
| 5 | S005 | Sambalpuri | Odisha | Cotton | Blue | 5500 | Medium |
| 6 | S006 | Pochampally | Telangana | Ikat | Yellow | 7500 | High |
| 7 | S007 | Muga | Assam | Silk | Beige | 9500 | High |
| 8 | S008 | KotaDoria | Rajasthan | Cotton | White | 4200 | Medium |
| 9 | S009 | Kasavu | Kerala | Cotton | Cream | 6000 | High |
| 10 | S010 | Patola | Gujarat | Silk | Multicolor | 15000 | VeryHigh |
| 11 | S011 | Baluchari | WestBengal | Silk | Maroon | 9000 | High |
| 12 | S012 | Narayanpet | Telangana | Cotton | Orange | 5000 | Medium |
4. SORT DATA BY STATE AND PRICE (DESCENDING)
proc sort data=work.Indian_Sarees out=Sarees_Sorted;
by State descending Price;
run;
proc print data=work.Sarees_Sorted;
title "SAREES SORTED BY STATE AND DESCENDING PRICE";
run;
OUTPUT:
| Obs | SareeID | SareeName | State | Fabric | Color | Price | Popularity |
|---|---|---|---|---|---|---|---|
| 1 | S007 | Muga | Assam | Silk | Beige | 9500 | High |
| 2 | S010 | Patola | Gujarat | Silk | Multicolor | 15000 | VeryHigh |
| 3 | S009 | Kasavu | Kerala | Cotton | Cream | 6000 | High |
| 4 | S003 | Chanderi | MadhyaPradesh | Cotton | Pink | 4500 | Medium |
| 5 | S004 | Paithani | Maharashtra | Silk | Green | 10000 | High |
| 6 | S005 | Sambalpuri | Odisha | Cotton | Blue | 5500 | Medium |
| 7 | S008 | KotaDoria | Rajasthan | Cotton | White | 4200 | Medium |
| 8 | S002 | Kanjeevaram | TamilNadu | Silk | Gold | 12000 | VeryHigh |
| 9 | S006 | Pochampally | Telangana | Ikat | Yellow | 7500 | High |
| 10 | S012 | Narayanpet | Telangana | Cotton | Orange | 5000 | Medium |
| 11 | S001 | Banarasi | UttarPradesh | Silk | Red | 8500 | High |
| 12 | S011 | Baluchari | WestBengal | Silk | Maroon | 9000 | High |
5. FREQUENCY DISTRIBUTION OF FABRIC AND POPULARITY
proc freq data=work.Indian_Sarees;
table Fabric * Popularity / nocum nopercent;
title "FREQUENCY TABLE: FABRIC VS POPULARITY";
run;
OUTPUT:
The FREQ Procedure
|
| |||||||||||||||||||||||||||||||||||
6. DESCRIPTIVE STATISTICS OF PRICE BY FABRIC
proc means data=work.Indian_Sarees;
class Fabric;
var price;
title "PRICE STATISTICS BY FABRIC TYPE";
run;
OUTPUT:
The MEANS Procedure
| Analysis Variable : Price | ||||||
|---|---|---|---|---|---|---|
| Fabric | N Obs | N | Mean | Std Dev | Minimum | Maximum |
| Cotton | 5 | 5 | 5040.00 | 730.0684899 | 4200.00 | 6000.00 |
| Ikat | 1 | 1 | 7500.00 | . | 7500.00 | 7500.00 |
| Silk | 6 | 6 | 10666.67 | 2442.68 | 8500.00 | 15000.00 |
7. SQL QUERY: SAREES PRICED ABOVE 8000
proc sql;
select *
from work.Indian_Sarees
where price > 8000
group by Fabric
order by SareeID;
quit;
OUTPUT:
| SareeID | SareeName | State | Fabric | Color | Price | Popularity |
|---|---|---|---|---|---|---|
| S001 | Banarasi | UttarPradesh | Silk | Red | 8500 | High |
| S002 | Kanjeevaram | TamilNadu | Silk | Gold | 12000 | VeryHigh |
| S004 | Paithani | Maharashtra | Silk | Green | 10000 | High |
| S007 | Muga | Assam | Silk | Beige | 9500 | High |
| S010 | Patola | Gujarat | Silk | Multicolor | 15000 | VeryHigh |
| S011 | Baluchari | WestBengal | Silk | Maroon | 9000 | High |
8. SQL: AVERAGE PRICE BY STATE
proc sql;
select state,
avg(Price) as AvgPrice format=8.2
from work.Indian_Sarees
group by State;
quit;
OUTPUT:
| State | AvgPrice |
|---|---|
| Assam | 9500.00 |
| Gujarat | 15000.00 |
| Kerala | 6000.00 |
| MadhyaPradesh | 4500.00 |
| Maharashtra | 10000.00 |
| Odisha | 5500.00 |
| Rajasthan | 4200.00 |
| TamilNadu | 12000.00 |
| Telangana | 6250.00 |
| UttarPradesh | 8500.00 |
| WestBengal | 9000.00 |
9. SQL: SAREES PRICED ABOVE OVERALL AVERAGE
proc sql;
select sareename, price
from work.indian_sarees
where price > (select avg(Price)
from work.indian_sarees);
quit;
OUTPUT:
| SareeName | Price |
|---|---|
| Banarasi | 8500 |
| Kanjeevaram | 12000 |
| Paithani | 10000 |
| Muga | 9500 |
| Patola | 15000 |
| Baluchari | 9000 |
10. MACRO: GENERATE STATE-WISE REPORTS
%macro Saree_Report(State);
title "SAREE REPORT FOR &State";
/* Print Sarees by Selected State */
proc print data=work.Indian_Sarees;
where State = "&State";
title2 "Saree Details for &State";
run;
/* Summary Stats for that State */
proc means data=work.Indian_Sarees n mean std min max;
where State = "&State";
var price;
title2 "Price Summary for &State";
run;
/* Fabric-Popularity Relationship */
proc freq data=work.Indian_Sarees;
where State = "&State";
tables fabric * popularity;
title2 "Fabric vs Popularity for &State";
run;
%mend;
%Saree_Report(Telangana)
OUTPUT:
| Obs | SareeID | SareeName | State | Fabric | Color | Price | Popularity |
|---|---|---|---|---|---|---|---|
| 6 | S006 | Pochampally | Telangana | Ikat | Yellow | 7500 | High |
| 12 | S012 | Narayanpet | Telangana | Cotton | Orange | 5000 | Medium |
The MEANS Procedure
| Analysis Variable : Price | ||||
|---|---|---|---|---|
| N | Mean | Std Dev | Minimum | Maximum |
| 2 | 6250.00 | 1767.77 | 5000.00 | 7500.00 |
The FREQ Procedure
|
| ||||||||||||||||||||||||
%Saree_Report(Gujarat)
OUTPUT:
| Obs | SareeID | SareeName | State | Fabric | Color | Price | Popularity |
|---|---|---|---|---|---|---|---|
| 10 | S010 | Patola | Gujarat | Silk | Multicolor | 15000 | VeryHigh |
The MEANS Procedure
| Analysis Variable : Price | ||||
|---|---|---|---|---|
| N | Mean | Std Dev | Minimum | Maximum |
| 1 | 15000.00 | . | 15000.00 | 15000.00 |
The FREQ Procedure
|
| |||||||||||||||