241.COMPREHENSIVE TABLETS MARKET ANALYSIS USING PROC PRINT | PROC SORT | PROC MEANS | PROC FREQ | PROC SQL | SAS MACROS | CONDITIONAL LOGIC | DATA JOINS | AND REPORT AUTOMATION IN SAS

COMPREHENSIVE TABLETS MARKET ANALYSIS USING PROC PRINT | PROC SORT | PROC MEANS | PROC FREQ | PROC SQL | SAS MACROS | CONDITIONAL LOGIC | DATA JOINS | AND REPORT AUTOMATION IN SAS

/*Creating a dataset of different types of tablets*/

STEP 1: CREATING THE TABLETS DATASET

options  nocenter;

data Tablet_Inventory;

    length Brand $20 Model $25 Processor $20 OS $10;

    input TabletID Brand $ Model $ ScreenSize RAM_GB Storage_GB Processor $ Battery_mAh Price_INR OS $ Rating;

    datalines;

1 Apple iPad_10 10.2 4 64 A13 8557 30900 iOS 4.5

2 Samsung Galaxy_Tab_A8 10.5 4 64 Unisoc 7040 18999 Android 4.2

3 Lenovo Tab_M10 10.1 4 64 Snapdragon 5000 15999 Android 4.0

4 Xiaomi Pad_5 11 6 128 Snapdragon860 8720 25999 Android 4.6

5 Realme Pad_X 10.95 6 128 Snapdragon695 8340 19999 Android 4.4

6 Apple iPad_Air 10.9 8 256 M1 7606 59900 iOS 4.8

7 Samsung Galaxy_Tab_S6 10.4 6 128 Exynos 7040 28999 Android 4.3

8 Microsoft Surface_Go3 10.5 4 128 Intel 6000 42999 Windows 4.1

9 Lenovo Yoga_Tab_11 11 4 128 MediaTek 7500 24999 Android 4.0

10 Nokia T20 10.4 4 64 Unisoc 8200 15499 Android 3.8

11 Huawei MatePad_T10s 10.1 3 64 Kirin710A 5100 17999 Android 3.9

12 Acer Iconia_Tab 10.1 3 32 MediaTek 6000 12999 Android 3.7

13 Asus ZenPad_3S 9.7 4 64 MediaTek 5900 14999 Android 4.0

14 Amazon Fire_HD10 10.1 3 32 MediaTek 6500 11999 Android 3.5

15 Lava Magnum 10.1 2 32 Unisoc 6100 8999 Android 3.4

16 Micromax Canvas_Laptab 10.1 2 32 Intel 7700 11999 Windows 3.6

17 Dell Venue_8_Pro 8 2 64 Intel 4830 14999 Windows 3.8

18 Apple iPad_Mini 8.3 4 64 A15 5124 44900 iOS 4.6

19 Samsung Galaxy_Tab_S7 11 6 128 Snapdragon865+ 8000 50999 Android 4.7

20 Lenovo Tab_P11 11.5 6 128 Snapdragon750G 7700 29999 Android 4.4

21 Honor Pad_8 12 6 128 Snapdragon680 7250 19999 Android 4.3

22 Huawei MatePad_Pro 10.8 8 256 Kirin990 7250 46999 Android 4.6

23 iBall Slide_Elan 10.1 3 32 Intel 7000 10999 Android 3.2

24 Samsung Galaxy_Tab_S8 11 8 256 Snapdragon8Gen1 8000 58999 Android 4.9

25 Apple iPad_Pro 12.9 8 512 M2 9720 99900 iOS 4.9

26 Microsoft Surface_Pro7 12.3 8 256 Intel_i5 8000 74999 Windows 4.6

27 Realme Pad_Mini 8.7 3 32 Unisoc 6400 10999 Android 3.8

28 Lenovo Tab_M9 9 3 32 MediaTek 5100 9999 Android 3.6

29 Xiaomi Pad_6 11 8 256 Snapdragon870 8840 32999 Android 4.8

30 Samsung Galaxy_Tab_S6_Lite 10.4 4 64 Exynos9611 7040 23499 Android 4.3

;

run;

proc print;run;

Output:

Obs Brand Model Processor OS TabletID ScreenSize RAM_GB Storage_GB Battery_mAh Price_INR Rating
1 Apple iPad_10 A13 iOS 1 10.20 4 64 8557 30900 4.5
2 Samsung Galaxy_Tab_A8 Unisoc Android 2 10.50 4 64 7040 18999 4.2
3 Lenovo Tab_M10 Snapdragon Android 3 10.10 4 64 5000 15999 4.0
4 Xiaomi Pad_5 Snapdragon860 Android 4 11.00 6 128 8720 25999 4.6
5 Realme Pad_X Snapdragon695 Android 5 10.95 6 128 8340 19999 4.4
6 Apple iPad_Air M1 iOS 6 10.90 8 256 7606 59900 4.8
7 Samsung Galaxy_Tab_S6 Exynos Android 7 10.40 6 128 7040 28999 4.3
8 Microsoft Surface_Go3 Intel Windows 8 10.50 4 128 6000 42999 4.1
9 Lenovo Yoga_Tab_11 MediaTek Android 9 11.00 4 128 7500 24999 4.0
10 Nokia T20 Unisoc Android 10 10.40 4 64 8200 15499 3.8
11 Huawei MatePad_T10s Kirin710A Android 11 10.10 3 64 5100 17999 3.9
12 Acer Iconia_Tab MediaTek Android 12 10.10 3 32 6000 12999 3.7
13 Asus ZenPad_3S MediaTek Android 13 9.70 4 64 5900 14999 4.0
14 Amazon Fire_HD10 MediaTek Android 14 10.10 3 32 6500 11999 3.5
15 Lava Magnum Unisoc Android 15 10.10 2 32 6100 8999 3.4
16 Micromax Canvas_Laptab Intel Windows 16 10.10 2 32 7700 11999 3.6
17 Dell Venue_8_Pro Intel Windows 17 8.00 2 64 4830 14999 3.8
18 Apple iPad_Mini A15 iOS 18 8.30 4 64 5124 44900 4.6
19 Samsung Galaxy_Tab_S7 Snapdragon865+ Android 19 11.00 6 128 8000 50999 4.7
20 Lenovo Tab_P11 Snapdragon750G Android 20 11.50 6 128 7700 29999 4.4
21 Honor Pad_8 Snapdragon680 Android 21 12.00 6 128 7250 19999 4.3
22 Huawei MatePad_Pro Kirin990 Android 22 10.80 8 256 7250 46999 4.6
23 iBall Slide_Elan Intel Android 23 10.10 3 32 7000 10999 3.2
24 Samsung Galaxy_Tab_S8 Snapdragon8Gen1 Android 24 11.00 8 256 8000 58999 4.9
25 Apple iPad_Pro M2 iOS 25 12.90 8 512 9720 99900 4.9
26 Microsoft Surface_Pro7 Intel_i5 Windows 26 12.30 8 256 8000 74999 4.6
27 Realme Pad_Mini Unisoc Android 27 8.70 3 32 6400 10999 3.8
28 Lenovo Tab_M9 MediaTek Android 28 9.00 3 32 5100 9999 3.6
29 Xiaomi Pad_6 Snapdragon870 Android 29 11.00 8 256 8840 32999 4.8
30 Samsung Galaxy_Tab_S6_Lite Exynos9611 Android 30 10.40 4 64 7040 23499 4.3


STEP 2: DISPLAYING THE DATA

proc print data=Tablet_Inventory noobs;

    title "All Tablets in Inventory";

run;

Output:

All Tablets in Inventory

Brand Model Processor OS TabletID ScreenSize RAM_GB Storage_GB Battery_mAh Price_INR Rating
Apple iPad_10 A13 iOS 1 10.20 4 64 8557 30900 4.5
Samsung Galaxy_Tab_A8 Unisoc Android 2 10.50 4 64 7040 18999 4.2
Lenovo Tab_M10 Snapdragon Android 3 10.10 4 64 5000 15999 4.0
Xiaomi Pad_5 Snapdragon860 Android 4 11.00 6 128 8720 25999 4.6
Realme Pad_X Snapdragon695 Android 5 10.95 6 128 8340 19999 4.4
Apple iPad_Air M1 iOS 6 10.90 8 256 7606 59900 4.8
Samsung Galaxy_Tab_S6 Exynos Android 7 10.40 6 128 7040 28999 4.3
Microsoft Surface_Go3 Intel Windows 8 10.50 4 128 6000 42999 4.1
Lenovo Yoga_Tab_11 MediaTek Android 9 11.00 4 128 7500 24999 4.0
Nokia T20 Unisoc Android 10 10.40 4 64 8200 15499 3.8
Huawei MatePad_T10s Kirin710A Android 11 10.10 3 64 5100 17999 3.9
Acer Iconia_Tab MediaTek Android 12 10.10 3 32 6000 12999 3.7
Asus ZenPad_3S MediaTek Android 13 9.70 4 64 5900 14999 4.0
Amazon Fire_HD10 MediaTek Android 14 10.10 3 32 6500 11999 3.5
Lava Magnum Unisoc Android 15 10.10 2 32 6100 8999 3.4
Micromax Canvas_Laptab Intel Windows 16 10.10 2 32 7700 11999 3.6
Dell Venue_8_Pro Intel Windows 17 8.00 2 64 4830 14999 3.8
Apple iPad_Mini A15 iOS 18 8.30 4 64 5124 44900 4.6
Samsung Galaxy_Tab_S7 Snapdragon865+ Android 19 11.00 6 128 8000 50999 4.7
Lenovo Tab_P11 Snapdragon750G Android 20 11.50 6 128 7700 29999 4.4
Honor Pad_8 Snapdragon680 Android 21 12.00 6 128 7250 19999 4.3
Huawei MatePad_Pro Kirin990 Android 22 10.80 8 256 7250 46999 4.6
iBall Slide_Elan Intel Android 23 10.10 3 32 7000 10999 3.2
Samsung Galaxy_Tab_S8 Snapdragon8Gen1 Android 24 11.00 8 256 8000 58999 4.9
Apple iPad_Pro M2 iOS 25 12.90 8 512 9720 99900 4.9
Microsoft Surface_Pro7 Intel_i5 Windows 26 12.30 8 256 8000 74999 4.6
Realme Pad_Mini Unisoc Android 27 8.70 3 32 6400 10999 3.8
Lenovo Tab_M9 MediaTek Android 28 9.00 3 32 5100 9999 3.6
Xiaomi Pad_6 Snapdragon870 Android 29 11.00 8 256 8840 32999 4.8
Samsung Galaxy_Tab_S6_Lite Exynos9611 Android 30 10.40 4 64 7040 23499 4.3


STEP 3: SORTING DATA BY PRICE

proc sort data=Tablet_Inventory out=SortedTablets;

    by descending Price_INR;

run;


proc print data=SortedTablets;

    title "Tablets Sorted by Price (High to Low)";

run;

Output:

Tablets Sorted by Price (High to Low)

Obs Brand Model Processor OS TabletID ScreenSize RAM_GB Storage_GB Battery_mAh Price_INR Rating
1 Apple iPad_Pro M2 iOS 25 12.90 8 512 9720 99900 4.9
2 Microsoft Surface_Pro7 Intel_i5 Windows 26 12.30 8 256 8000 74999 4.6
3 Apple iPad_Air M1 iOS 6 10.90 8 256 7606 59900 4.8
4 Samsung Galaxy_Tab_S8 Snapdragon8Gen1 Android 24 11.00 8 256 8000 58999 4.9
5 Samsung Galaxy_Tab_S7 Snapdragon865+ Android 19 11.00 6 128 8000 50999 4.7
6 Huawei MatePad_Pro Kirin990 Android 22 10.80 8 256 7250 46999 4.6
7 Apple iPad_Mini A15 iOS 18 8.30 4 64 5124 44900 4.6
8 Microsoft Surface_Go3 Intel Windows 8 10.50 4 128 6000 42999 4.1
9 Xiaomi Pad_6 Snapdragon870 Android 29 11.00 8 256 8840 32999 4.8
10 Apple iPad_10 A13 iOS 1 10.20 4 64 8557 30900 4.5
11 Lenovo Tab_P11 Snapdragon750G Android 20 11.50 6 128 7700 29999 4.4
12 Samsung Galaxy_Tab_S6 Exynos Android 7 10.40 6 128 7040 28999 4.3
13 Xiaomi Pad_5 Snapdragon860 Android 4 11.00 6 128 8720 25999 4.6
14 Lenovo Yoga_Tab_11 MediaTek Android 9 11.00 4 128 7500 24999 4.0
15 Samsung Galaxy_Tab_S6_Lite Exynos9611 Android 30 10.40 4 64 7040 23499 4.3
16 Realme Pad_X Snapdragon695 Android 5 10.95 6 128 8340 19999 4.4
17 Honor Pad_8 Snapdragon680 Android 21 12.00 6 128 7250 19999 4.3
18 Samsung Galaxy_Tab_A8 Unisoc Android 2 10.50 4 64 7040 18999 4.2
19 Huawei MatePad_T10s Kirin710A Android 11 10.10 3 64 5100 17999 3.9
20 Lenovo Tab_M10 Snapdragon Android 3 10.10 4 64 5000 15999 4.0
21 Nokia T20 Unisoc Android 10 10.40 4 64 8200 15499 3.8
22 Asus ZenPad_3S MediaTek Android 13 9.70 4 64 5900 14999 4.0
23 Dell Venue_8_Pro Intel Windows 17 8.00 2 64 4830 14999 3.8
24 Acer Iconia_Tab MediaTek Android 12 10.10 3 32 6000 12999 3.7
25 Amazon Fire_HD10 MediaTek Android 14 10.10 3 32 6500 11999 3.5
26 Micromax Canvas_Laptab Intel Windows 16 10.10 2 32 7700 11999 3.6
27 iBall Slide_Elan Intel Android 23 10.10 3 32 7000 10999 3.2
28 Realme Pad_Mini Unisoc Android 27 8.70 3 32 6400 10999 3.8
29 Lenovo Tab_M9 MediaTek Android 28 9.00 3 32 5100 9999 3.6
30 Lava Magnum Unisoc Android 15 10.10 2 32 6100 8999 3.4

STEP 4: SUMMARY STATS USING PROC MEANS

proc means data=Tablet_Inventory mean min max std maxdec=2;

    var ScreenSize RAM_GB Storage_GB Battery_mAh Price_INR Rating;

    title "Descriptive Statistics of Tablet Specifications";

run;

Output:

Descriptive Statistics of Tablet Specifications

The MEANS Procedure

Variable Mean Minimum Maximum Std Dev
ScreenSize
RAM_GB
Storage_GB
Battery_mAh
Price_INR
Rating
10.44
4.80
120.53
7051.90
29785.80
4.18
8.00
2.00
32.00
4830.00
8999.00
3.20
12.90
8.00
512.00
9720.00
99900.00
4.90
1.06
2.02
106.52
1288.23
21720.17
0.48

STEP 5: FREQUENCY OF OS & BRANDS

proc freq data=Tablet_Inventory;

    tables OS Brand;

    title "Frequency Distribution of Operating Systems and Brands";

run;

Output:

Frequency Distribution of Operating Systems and Brands

The FREQ Procedure

OS Frequency Percent Cumulative
Frequency
Cumulative
Percent
Android 22 73.33 22 73.33
Windows 4 13.33 26 86.67
iOS 4 13.33 30 100.00

Brand Frequency Percent Cumulative
Frequency
Cumulative
Percent
Acer 1 3.33 1 3.33
Amazon 1 3.33 2 6.67
Apple 4 13.33 6 20.00
Asus 1 3.33 7 23.33
Dell 1 3.33 8 26.67
Honor 1 3.33 9 30.00
Huawei 2 6.67 11 36.67
Lava 1 3.33 12 40.00
Lenovo 4 13.33 16 53.33
Micromax 1 3.33 17 56.67
Microsoft 2 6.67 19 63.33
Nokia 1 3.33 20 66.67
Realme 2 6.67 22 73.33
Samsung 5 16.67 27 90.00
Xiaomi 2 6.67 29 96.67
iBall 1 3.33 30 100.00

STEP 6: ANALYSIS USING PROC SQL

a) Average Price by Brand

proc sql;

    select Brand, count(*) as Count_Tablets, avg(Price_INR) as Avg_Price format=comma10.

    from Tablet_Inventory

    group by Brand

    order by Avg_Price desc;

quit;

Output:

Brand Count_Tablets Avg_Price
Microsoft 2 58,999
Apple 4 58,900
Samsung 5 36,299
Huawei 2 32,499
Xiaomi 2 29,499
Lenovo 4 20,249
Honor 1 19,999
Realme 2 15,499
Nokia 1 15,499
Dell 1 14,999
Asus 1 14,999
Acer 1 12,999
Micromax 1 11,999
Amazon 1 11,999
iBall 1 10,999
Lava 1 8,999

b) Top 5 Tablets with Highest Ratings

proc sql outobs=5;

    select Brand, Model, Rating, Price_INR

    from Tablet_Inventory

    order by Rating desc, Price_INR desc;

quit;

Output:

Brand Model Rating Price_INR
Apple iPad_Pro 4.9 99900
Samsung Galaxy_Tab_S8 4.9 58999
Apple iPad_Air 4.8 59900
Xiaomi Pad_6 4.8 32999
Samsung Galaxy_Tab_S7 4.7 50999

c) Tablets with RAM >= 6 GB and Android OS

proc sql;

    select TabletID, Brand, Model, RAM_GB, OS

    from Tablet_Inventory

    where RAM_GB >= 6 and OS = 'Android';

quit;

Output:

TabletID Brand Model RAM_GB OS
4 Xiaomi Pad_5 6 Android
5 Realme Pad_X 6 Android
7 Samsung Galaxy_Tab_S6 6 Android
19 Samsung Galaxy_Tab_S7 6 Android
20 Lenovo Tab_P11 6 Android
21 Honor Pad_8 6 Android
22 Huawei MatePad_Pro 8 Android
24 Samsung Galaxy_Tab_S8 8 Android
29 Xiaomi Pad_6 8 Android


STEP 7: USING MACROS TO FILTER BY OS

%macro FilterByOS(os=);

    proc sql;

        title "Tablets with OS = &os.";

        select TabletID, Brand, Model, OS, Price_INR

        from Tablet_Inventory

        where OS = "&os.";

    quit;

%mend;


%FilterByOS(os=Android);

Output:

Tablets with OS = Android

TabletID Brand Model OS Price_INR
2 Samsung Galaxy_Tab_A8 Android 18999
3 Lenovo Tab_M10 Android 15999
4 Xiaomi Pad_5 Android 25999
5 Realme Pad_X Android 19999
7 Samsung Galaxy_Tab_S6 Android 28999
9 Lenovo Yoga_Tab_11 Android 24999
10 Nokia T20 Android 15499
11 Huawei MatePad_T10s Android 17999
12 Acer Iconia_Tab Android 12999
13 Asus ZenPad_3S Android 14999
14 Amazon Fire_HD10 Android 11999
15 Lava Magnum Android 8999
19 Samsung Galaxy_Tab_S7 Android 50999
20 Lenovo Tab_P11 Android 29999
21 Honor Pad_8 Android 19999
22 Huawei MatePad_Pro Android 46999
23 iBall Slide_Elan Android 10999
24 Samsung Galaxy_Tab_S8 Android 58999
27 Realme Pad_Mini Android 10999
28 Lenovo Tab_M9 Android 9999
29 Xiaomi Pad_6 Android 32999
30 Samsung Galaxy_Tab_S6_Lite Android 23499

%FilterByOS(os=iOS);

Output:

Tablets with OS = iOS

TabletID Brand Model OS Price_INR
1 Apple iPad_10 iOS 30900
6 Apple iPad_Air iOS 59900
18 Apple iPad_Mini iOS 44900
25 Apple iPad_Pro iOS 99900

%FilterByOS(os=Windows);

Output:

Tablets with OS = Windows

TabletID Brand Model OS Price_INR
8 Microsoft Surface_Go3 Windows 42999
16 Micromax Canvas_Laptab Windows 11999
17 Dell Venue_8_Pro Windows 14999
26 Microsoft Surface_Pro7 Windows 74999

STEP 8: RATING-BASED CLASSIFICATION

data Rating_Categories;

    set Tablet_Inventory;

    length RatingLevel $10;

    if Rating >= 4.5 then RatingLevel = "Excellent";

    else if Rating >= 4.0 then RatingLevel = "Good";

    else if Rating >= 3.5 then RatingLevel = "Average";

    else RatingLevel = "Poor";

run;

proc print;run;

Output:

Obs Brand Model Processor OS TabletID ScreenSize RAM_GB Storage_GB Battery_mAh Price_INR Rating RatingLevel
1 Apple iPad_10 A13 iOS 1 10.20 4 64 8557 30900 4.5 Excellent
2 Samsung Galaxy_Tab_A8 Unisoc Android 2 10.50 4 64 7040 18999 4.2 Good
3 Lenovo Tab_M10 Snapdragon Android 3 10.10 4 64 5000 15999 4.0 Good
4 Xiaomi Pad_5 Snapdragon860 Android 4 11.00 6 128 8720 25999 4.6 Excellent
5 Realme Pad_X Snapdragon695 Android 5 10.95 6 128 8340 19999 4.4 Good
6 Apple iPad_Air M1 iOS 6 10.90 8 256 7606 59900 4.8 Excellent
7 Samsung Galaxy_Tab_S6 Exynos Android 7 10.40 6 128 7040 28999 4.3 Good
8 Microsoft Surface_Go3 Intel Windows 8 10.50 4 128 6000 42999 4.1 Good
9 Lenovo Yoga_Tab_11 MediaTek Android 9 11.00 4 128 7500 24999 4.0 Good
10 Nokia T20 Unisoc Android 10 10.40 4 64 8200 15499 3.8 Average
11 Huawei MatePad_T10s Kirin710A Android 11 10.10 3 64 5100 17999 3.9 Average
12 Acer Iconia_Tab MediaTek Android 12 10.10 3 32 6000 12999 3.7 Average
13 Asus ZenPad_3S MediaTek Android 13 9.70 4 64 5900 14999 4.0 Good
14 Amazon Fire_HD10 MediaTek Android 14 10.10 3 32 6500 11999 3.5 Average
15 Lava Magnum Unisoc Android 15 10.10 2 32 6100 8999 3.4 Poor
16 Micromax Canvas_Laptab Intel Windows 16 10.10 2 32 7700 11999 3.6 Average
17 Dell Venue_8_Pro Intel Windows 17 8.00 2 64 4830 14999 3.8 Average
18 Apple iPad_Mini A15 iOS 18 8.30 4 64 5124 44900 4.6 Excellent
19 Samsung Galaxy_Tab_S7 Snapdragon865+ Android 19 11.00 6 128 8000 50999 4.7 Excellent
20 Lenovo Tab_P11 Snapdragon750G Android 20 11.50 6 128 7700 29999 4.4 Good
21 Honor Pad_8 Snapdragon680 Android 21 12.00 6 128 7250 19999 4.3 Good
22 Huawei MatePad_Pro Kirin990 Android 22 10.80 8 256 7250 46999 4.6 Excellent
23 iBall Slide_Elan Intel Android 23 10.10 3 32 7000 10999 3.2 Poor
24 Samsung Galaxy_Tab_S8 Snapdragon8Gen1 Android 24 11.00 8 256 8000 58999 4.9 Excellent
25 Apple iPad_Pro M2 iOS 25 12.90 8 512 9720 99900 4.9 Excellent
26 Microsoft Surface_Pro7 Intel_i5 Windows 26 12.30 8 256 8000 74999 4.6 Excellent
27 Realme Pad_Mini Unisoc Android 27 8.70 3 32 6400 10999 3.8 Average
28 Lenovo Tab_M9 MediaTek Android 28 9.00 3 32 5100 9999 3.6 Average
29 Xiaomi Pad_6 Snapdragon870 Android 29 11.00 8 256 8840 32999 4.8 Excellent
30 Samsung Galaxy_Tab_S6_Lite Exynos9611 Android 30 10.40 4 64 7040 23499 4.3 Good

proc freq data=Rating_Categories;

    tables RatingLevel;

    title "Tablets Grouped by Rating Levels";

run;

Output:

Tablets Grouped by Rating Levels

The FREQ Procedure

RatingLevel Frequency Percent Cumulative
Frequency
Cumulative
Percent
Average 8 26.67 8 26.67
Excellent 10 33.33 18 60.00
Good 10 33.33 28 93.33
Poor 2 6.67 30 100.00

STEP 9: ADVANCED AGGREGATION WITH SQL JOIN

data Tablet_Sales;

    input TabletID Units_Sold;

    datalines;

1 1500

2 3000

3 2500

4 4000

5 3200

6 1000

7 1200

8 900

9 2200

10 2700

11 1800

12 1600

13 1900

14 2100

15 2000

16 1000

17 800

18 1300

19 1100

20 2400

21 2100

22 1000

23 1700

24 950

25 500

26 650

27 2000

28 1500

29 1400

30 1150

;

run;

proc print;run;

Output:

Obs TabletID Units_Sold
1 1 1500
2 2 3000
3 3 2500
4 4 4000
5 5 3200
6 6 1000
7 7 1200
8 8 900
9 9 2200
10 10 2700
11 11 1800
12 12 1600
13 13 1900
14 14 2100
15 15 2000
16 16 1000
17 17 800
18 18 1300
19 19 1100
20 20 2400
21 21 2100
22 22 1000
23 23 1700
24 24 950
25 25 500
26 26 650
27 27 2000
28 28 1500
29 29 1400
30 30 1150

SQL JOIN: Inventory + Sales

proc sql;

    create table Tablet_Sales_Summary as

    select a.Brand, a.Model, a.Price_INR, b.Units_Sold,

           (a.Price_INR * b.Units_Sold) as Revenue format=comma12.

    from Tablet_Inventory as a

    inner join Tablet_Sales as b

    on a.TabletID = b.TabletID;

quit;


proc print data=Tablet_Sales_Summary (obs=10);

    title "Revenue Summary for First 10 Tablets";

run;

Output:

Revenue Summary for First 10 Tablets

Obs Brand Model Price_INR Units_Sold Revenue
1 Apple iPad_10 30900 1500 46,350,000
2 Samsung Galaxy_Tab_A8 18999 3000 56,997,000
3 Lenovo Tab_M10 15999 2500 39,997,500
4 Xiaomi Pad_5 25999 4000 103,996,000
5 Realme Pad_X 19999 3200 63,996,800
6 Apple iPad_Air 59900 1000 59,900,000
7 Samsung Galaxy_Tab_S6 28999 1200 34,798,800
8 Microsoft Surface_Go3 42999 900 38,699,100
9 Lenovo Yoga_Tab_11 24999 2200 54,997,800
10 Nokia T20 15499 2700 41,847,300

STEP 10: MACRO FOR REVENUE REPORTING

%macro TopRevenue(n=5);

    proc sql outobs=&n.;

        select Brand, Model, Revenue

        from Tablet_Sales_Summary

        order by Revenue desc;

    quit;

%mend;


%TopRevenue(n=10);

Output:

Brand Model Revenue
Xiaomi Pad_5 103,996,000
Lenovo Tab_P11 71,997,600
Realme Pad_X 63,996,800
Apple iPad_Air 59,900,000
Apple iPad_Mini 58,370,000
Samsung Galaxy_Tab_A8 56,997,000
Samsung Galaxy_Tab_S7 56,098,900
Samsung Galaxy_Tab_S8 56,049,050
Lenovo Yoga_Tab_11 54,997,800
Apple iPad_Pro 49,950,000






To Visit My Previous Online Streaming Flatform Dataset:Click Here
To Visit My Previous Statistical Evaluation Of Clinical Trials:Click Here
To Visit My Previous Unlocking Retail Insights Dataset:Click Here
To Visit My Previous Sas Interview Questions-1:Click Here





--->PLEASE 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