212.ANALYZING GLOBAL CLOTHING TRENDS BY CATEGORY REGION MATERIAL CLIMATE PRICE USING PROC SQL | PROC FREQ | PROC MEANS | PROC MACRO IN SAS

ANALYZING GLOBAL CLOTHING TRENDS BY CATEGORY REGION MATERIAL CLIMATE PRICE USING  PROC SQL | PROC FREQ | PROC MEANS | PROC MACRO IN SAS

 /*Creating a unique dataset about different types of clothes worldwide*/

STEP 1: DATA CREATION

Define a fictional dataset called World_Clothing, which includes various types of clothing across countries, categorized by:

Clothing_ID: Unique ID

Type: Shirt, Saree, Jacket, etc.

Region: Continent or specific country\

Material: Cotton, Wool, Silk, Polyester

Climate_Suitability: Hot, Cold, All-weather

Average_Cost_USD: Average price

Gender: Male, Female, Unisex

Popular_Season: Summer, Winter, Monsoon, All

Color: Common color

Tradition_Influence: Yes/No


data World_Clothing;

    length Clothing_ID 8 Type $15 Region $15 Material $15;

    input Clothing_ID Type $ Region $ Material $ Climate_Suitability $ 

          Average_Cost_USD Gender $ Popular_Season $ Color $ Tradition_Influence $;

    datalines;

1 Saree India Silk Hot 45 Female Summer Red Yes

2 Kimono Japan Silk Cold 100 Female Winter White Yes

3 Kilt Scotland Wool Cold 85 Male All Green Yes

4 Dashiki Nigeria Cotton Hot 35 Male Summer Multi Yes

5 Parka Canada Polyester Cold 120 Unisex Winter Black No

6 Poncho Peru Wool Cold 50 Unisex Winter Brown Yes

7 T-Shirt USA Cotton Hot 20 Unisex Summer Blue No

8 Hoodie UK Cotton Cold 35 Unisex Winter Grey No

9 Thawb SaudiArabia Cotton Hot 30 Male Summer White Yes

10 Cheongsam China Silk Hot 60 Female Summer Red Yes

11 Sarong Indonesia Cotton Hot 25 Female Monsoon Purple Yes

12 Kurta India Cotton All 40 Unisex All White Yes

13 Jeans USA Denim All 55 Unisex All Blue No

14 Blazer France Wool Cold 90 Male Winter Black No

15 Abaya UAE Silk Hot 70 Female All Black Yes

16 Lehenga India Silk Hot 100 Female Wedding Red Yes

17 Sweater Norway Wool Cold 65 Unisex Winter Navy No

18 Shalwar Pakistan Cotton All 30 Female Summer Pink Yes

19 TankTop Brazil Cotton Hot 15 Unisex Summer Yellow No

20 TrenchCoat UK Polyester Cold 110 Female Winter Beige No

;

run;

proc print;run;

Output:

Obs Clothing_ID Type Region Material Climate_Suitability Average_Cost_USD Gender Popular_Season Color Tradition_Influence
1 1 Saree India Silk Hot 45 Female Summer Red Yes
2 2 Kimono Japan Silk Cold 100 Female Winter White Yes
3 3 Kilt Scotland Wool Cold 85 Male All Green Yes
4 4 Dashiki Nigeria Cotton Hot 35 Male Summer Multi Yes
5 5 Parka Canada Polyester Cold 120 Unisex Winter Black No
6 6 Poncho Peru Wool Cold 50 Unisex Winter Brown Yes
7 7 T-Shirt USA Cotton Hot 20 Unisex Summer Blue No
8 8 Hoodie UK Cotton Cold 35 Unisex Winter Grey No
9 9 Thawb SaudiArabia Cotton Hot 30 Male Summer White Yes
10 10 Cheongsam China Silk Hot 60 Female Summer Red Yes
11 11 Sarong Indonesia Cotton Hot 25 Female Monsoon Purple Yes
12 12 Kurta India Cotton All 40 Unisex All White Yes
13 13 Jeans USA Denim All 55 Unisex All Blue No
14 14 Blazer France Wool Cold 90 Male Winter Black No
15 15 Abaya UAE Silk Hot 70 Female All Black Yes
16 16 Lehenga India Silk Hot 100 Female Wedding Red Yes
17 17 Sweater Norway Wool Cold 65 Unisex Winter Navy No
18 18 Shalwar Pakistan Cotton All 30 Female Summer Pink Yes
19 19 TankTop Brazil Cotton Hot 15 Unisex Summer Yellow No
20 20 TrenchCoat UK Polyester Cold 110 Female Winter Beige No


STEP 2: PROC PRINT – VIEWING RAW DATA

proc print data=World_Clothing label;

    title "Raw Dataset: Global Clothing Trends";

run;

Output:

Raw Dataset: Global Clothing Trends

Obs Clothing_ID Type Region Material Climate_Suitability Average_Cost_USD Gender Popular_Season Color Tradition_Influence
1 1 Saree India Silk Hot 45 Female Summer Red Yes
2 2 Kimono Japan Silk Cold 100 Female Winter White Yes
3 3 Kilt Scotland Wool Cold 85 Male All Green Yes
4 4 Dashiki Nigeria Cotton Hot 35 Male Summer Multi Yes
5 5 Parka Canada Polyester Cold 120 Unisex Winter Black No
6 6 Poncho Peru Wool Cold 50 Unisex Winter Brown Yes
7 7 T-Shirt USA Cotton Hot 20 Unisex Summer Blue No
8 8 Hoodie UK Cotton Cold 35 Unisex Winter Grey No
9 9 Thawb SaudiArabia Cotton Hot 30 Male Summer White Yes
10 10 Cheongsam China Silk Hot 60 Female Summer Red Yes
11 11 Sarong Indonesia Cotton Hot 25 Female Monsoon Purple Yes
12 12 Kurta India Cotton All 40 Unisex All White Yes
13 13 Jeans USA Denim All 55 Unisex All Blue No
14 14 Blazer France Wool Cold 90 Male Winter Black No
15 15 Abaya UAE Silk Hot 70 Female All Black Yes
16 16 Lehenga India Silk Hot 100 Female Wedding Red Yes
17 17 Sweater Norway Wool Cold 65 Unisex Winter Navy No
18 18 Shalwar Pakistan Cotton All 30 Female Summer Pink Yes
19 19 TankTop Brazil Cotton Hot 15 Unisex Summer Yellow No
20 20 TrenchCoat UK Polyester Cold 110 Female Winter Beige No


STEP 3: PROC SQL – FILTERING DATA

Example 1: Get all silk clothes for hot climate

proc sql;

    title "Silk Clothes Suitable for Hot Climates";

    select Clothing_ID, Type, Region, Material, Climate_Suitability, Average_Cost_USD

    from World_Clothing

    where Material = 'Silk' and Climate_Suitability = 'Hot';

quit;

Output:

Silk Clothes Suitable for Hot Climates

Clothing_ID Type Region Material Climate_Suitability Average_Cost_USD
1 Saree India Silk Hot 45
10 Cheongsam China Silk Hot 60
15 Abaya UAE Silk Hot 70
16 Lehenga India Silk Hot 100


Example 2: Top 5 costliest clothes

proc sql outobs=5;

    title "Top 5 Most Expensive Clothing Types";

    select Type, Region, Average_Cost_USD

    from World_Clothing

    order by Average_Cost_USD desc;

quit;

Output:

Top 5 Most Expensive Clothing Types

Type Region Average_Cost_USD
Parka Canada 120
TrenchCoat UK 110
Lehenga India 100
Kimono Japan 100
Blazer France 90


STEP 4: PROC FREQ – CATEGORICAL ANALYSIS

1. Count by Material

proc freq data=World_Clothing;

    tables Material / nocum;

    title "Frequency Distribution of Clothing Material";

run;

Output:

Frequency Distribution of Clothing Material

The FREQ Procedure

Material Frequency Percent
Cotton 8 40.00
Denim 1 5.00
Polyester 2 10.00
Silk 5 25.00
Wool 4 20.00


2. Count by Climate Suitability

proc freq data=World_Clothing;

    tables Climate_Suitability / nocum;

    title "Clothes Suitable for Different Climates";

run;

Output:

Clothes Suitable for Different Climates

The FREQ Procedure

Climate_Suitability Frequency Percent
All 3 15.00
Cold 8 40.00
Hot 9 45.00

3. Gender Distribution

proc freq data=World_Clothing;

    tables Gender;

    title "Clothing Gender Categories";

run;

Output:

Clothing Gender Categories

The FREQ Procedure

Gender Frequency Percent Cumulative
Frequency
Cumulative
Percent
Female 8 40.00 8 40.00
Male 4 20.00 12 60.00
Unisex 8 40.00 20 100.00


STEP 5: PROC MEANS – NUMERIC ANALYSIS

1.Average Cost by Material

proc means data=World_Clothing mean min max;

    class Material;

    var Average_Cost_USD;

    title "Average, Min, and Max Clothing Cost by Material";

run;

Output:

Average, Min, and Max Clothing Cost by Material

The MEANS Procedure

Analysis Variable : Average_Cost_USD
Material N Obs Mean Minimum Maximum
Cotton 8 28.7500000 15.0000000 40.0000000
Denim 1 55.0000000 55.0000000 55.0000000
Polyester 2 115.0000000 110.0000000 120.0000000
Silk 5 75.0000000 45.0000000 100.0000000
Wool 4 72.5000000 50.0000000 90.0000000


2.Average Cost by Region

proc means data=World_Clothing mean stddev maxdec=2;

    class Region;

    var Average_Cost_USD;

    title "Clothing Cost Stats by Region";

run;

Output:

Clothing Cost Stats by Region

The MEANS Procedure

Analysis Variable : Average_Cost_USD
Region N Obs Mean Std Dev
Brazil 1 15.00 .
Canada 1 120.00 .
China 1 60.00 .
France 1 90.00 .
India 3 61.67 33.29
Indonesia 1 25.00 .
Japan 1 100.00 .
Nigeria 1 35.00 .
Norway 1 65.00 .
Pakistan 1 30.00 .
Peru 1 50.00 .
SaudiArabia 1 30.00 .
Scotland 1 85.00 .
UAE 1 70.00 .
UK 2 72.50 53.03
USA 2 37.50 24.75


STEP 6: MACRO TO ANALYZE SPECIFIC MATERIAL

%macro material_analysis(mat);

    proc sql;

        title "Clothing Data for Material: &mat";

        select Type, Region, Climate_Suitability, Average_Cost_USD

        from World_Clothing

        where Material = "&mat";

    quit;


    proc means data=World_Clothing n mean std max min;

        where Material = "&mat";

        var Average_Cost_USD;

        title "Cost Analysis for &mat Clothes";

    run;

%mend;


%material_analysis(Silk);

Output:

Cost Analysis for Silk Clothes

The MEANS Procedure

Analysis Variable : Average_Cost_USD
N Mean Std Dev Maximum Minimum
5 75.0000000 24.4948974 100.0000000 45.0000000

%material_analysis(Cotton);

Output:

Cost Analysis for Cotton Clothes

The MEANS Procedure

Analysis Variable : Average_Cost_USD
N Mean Std Dev Maximum Minimum
8 28.7500000 8.3452296 40.0000000 15.0000000


STEP 7: CUSTOM MACRO FOR REGION + SEASON

%macro region_season_report(region, season);

    proc sql;

        title "Clothes in &region during &season";

        select Type, Material, Gender, Average_Cost_USD

        from World_Clothing

        where Region = "&region" and Popular_Season = "&season";

    quit;

%mend;


%region_season_report(India, Summer);

Output:

Clothes in India during Summer

Type Material Gender Average_Cost_USD
Saree Silk Female 45


%region_season_report(UK, Winter);

Output:

Clothes in UK during Winter

Type Material Gender Average_Cost_USD
Hoodie Cotton Unisex 35
TrenchCoat Polyester Female 110


STEP 8: UNIQUE INSIGHTS

1. Most common materials used

proc sql;

    select Material, count(*) as Count

    from World_Clothing

    group by Material

    order by Count desc;

quit;

Output:

Clothes in UK during Winter

Material Count
Cotton 8
Silk 5
Wool 4
Polyester 2
Denim 1


2. Tradition Influence Breakdown

proc freq data=World_Clothing;

    tables Tradition_Influence;

    title "Traditional vs Modern Clothing Influence";

run;

Output:

Traditional vs Modern Clothing Influence

The FREQ Procedure

Tradition_Influence Frequency Percent Cumulative
Frequency
Cumulative
Percent
No 8 40.00 8 40.00
Yes 12 60.00 20 100.00


3. Unisex clothing that suits all climates

proc sql;

    select Type, Region, Material

    from World_Clothing

    where Gender = 'Unisex' and Climate_Suitability = 'All';

quit;

Output:

Type Region Material
Kurta India Cotton
Jeans USA Denim


STEP 9: SUMMARY ANALYSIS BY SEASON

proc sql;

    select Popular_Season, 

           count(*) as Total_Items, 

           avg(Average_Cost_USD) as Avg_Cost

    from World_Clothing

    group by Popular_Season;

quit;

Output:
Popular_Season Total_Items Avg_Cost
All 4 62.5
Monsoon 1 25
Summer 7 33.57143
Wedding 1 100
Winter 7 81.42857




To Visit My Previous Book Store Dataset:Click Here
To Visit My Previous Festival Dataset:Click Here
To Visit My Previous SQL Joins:Click Here
To Visit My Previous Sas Interview Questions-1:Click Here




--->PRACTICE AND COMMENT YOUR OUTPUT: 

--->PLEASE FOLLOW OUR BLOG FOR MORE UPDATES.

PLEASE FOLLOW OUR TELEGRAM CHANNEL CLICK HERE

PLEASE FOLLOW OUR FACEBOOK PAGE  CLICK HERE

PLEASE FOLLOW OUR INSTAGRAM PAGE CLICK HERE



Comments