Wednesday, 19 November 2025

314.MODERN ELECTRONIC GADGETS DATA CREATION AND ANALYSIS USING PROC SQL | PROC MEANS | PROC UNIVARIATE | PROC SGPLOT | PROC RANK | MACROS WITH INTCK DERIVATIONS

MODERN ELECTRONIC GADGETS DATA CREATION AND ANALYSIS USING PROC SQL | PROC MEANS | PROC UNIVARIATE | PROC SGPLOT | PROC RANK | MACROS WITH INTCK DERIVATIONS

options nodate nonumber nocenter;

1) Create gadgets dataset using DATA Step

data work.gadgets;

infile datalines dsd dlm='|';

length Model $40 Brand $20 Category $15 Release_Date $10;

input Model :$40. Brand :$20. Category :$15. RAM_GB Storage_GB Battery_mAh

      Price_USD Rating Release_Date :$10.;

datalines;

iPhone 14 Pro|Apple|Phone|6|128|3200|999|4.6|2022-09-16

Galaxy S23|Samsung|Phone|8|256|3900|899|4.5|2023-02-17

Pixel 7|Google|Phone|8|128|4355|599|4.3|2022-10-13

MacBook Air M2|Apple|Laptop|8|256|5200|1199|4.7|2022-07-15

Dell XPS 13|Dell|Laptop|16|512|6000|999|4.4|2023-01-20

ThinkPad X1 Carbon|Lenovo|Laptop|16|1024|5800|1299|4.5|2022-09-05

Apple Watch Series 9|Apple|Smartwatch|1|32|300|399|4.6|2023-09-12

Galaxy Watch5|Samsung|Smartwatch|1|16|410|279|4.2|2022-08-26

AirPods Pro 2|Apple|Earbuds|1|1|  |249|4.4|2022-09-23

Surface Pro 9|Microsoft|Tablet|8|256|5000|999|4.1|2023-10-03

OnePlus 11|OnePlus|Phone|12|256|5000|699|4.3|2023-02-07

Pixel Watch 2|Google|Smartwatch|1|32|306|299|4.0|2023-05-10

Oppo Find X6|Oppo|Phone|12|256|4800|749|4.1|2023-03-15

Huawei MateBook 14|Huawei|Laptop|16|512|5600|899|4.0|2022-11-25

Bose QC Earbuds|Bose|Earbuds|1|1|  |279|4.2|2023-04-01

;

run;

proc print data=work.gadgets;

run;

OUTPUT:

ObsModelBrandCategoryRelease_DateRAM_GBStorage_GBBattery_mAhPrice_USDRating
1iPhone 14 ProApplePhone2022-09-16612832009994.6
2Galaxy S23SamsungPhone2023-02-17825639008994.5
3Pixel 7GooglePhone2022-10-13812843555994.3
4MacBook Air M2AppleLaptop2022-07-158256520011994.7
5Dell XPS 13DellLaptop2023-01-201651260009994.4
6ThinkPad X1 CarbonLenovoLaptop2022-09-05161024580012994.5
7Apple Watch Series 9AppleSmartwatch2023-09-121323003994.6
8Galaxy Watch5SamsungSmartwatch2022-08-261164102794.2
9AirPods Pro 2AppleEarbuds2022-09-2311.2494.4
10Surface Pro 9MicrosoftTablet2023-10-03825650009994.1
11OnePlus 11OnePlusPhone2023-02-071225650006994.3
12Pixel Watch 2GoogleSmartwatch2023-05-101323062994.0
13Oppo Find X6OppoPhone2023-03-151225648007494.1
14Huawei MateBook 14HuaweiLaptop2022-11-251651256008994.0
15Bose QC EarbudsBoseEarbuds2023-04-0111.2794.2


2) Clean and enhance dataset 

(convert Release_Date to SAS date, compute Battery_Life_est when missing, and other derived vars) 

data work.gadgets;

  set work.gadgets;

  /* Convert Release_Date from ISO text to SAS date */

  ReleaseDate = input(Release_Date, yymmdd10.);

  format ReleaseDate yymmdd10.;

  drop Release_Date;


  /* Standardize missing numeric battery for earbuds: use typical battery-life estimates */

  if Category = 'Earbuds' and (Battery_mAh = .) then do;

    /* earbuds tend to have small internal batteries — estimate playback minutes */

    Battery_mAh = 60; 

  end;


  /* Derive Battery_Life_hours: a heuristic estimate (not measured hours) */

  /* Use different heuristics by category */

  length Battery_Life_hours 8;

  if Category in: ('Phone') then Battery_Life_hours = round((Battery_mAh/400)*6, 0.1); 

  else if Category = 'Laptop' then Battery_Life_hours = round((Battery_mAh/600)*8, 0.1);

  else if Category = 'Smartwatch' then Battery_Life_hours = round((Battery_mAh/100)*1.2, 0.1);

  else if Category = 'Earbuds' then Battery_Life_hours = round((Battery_mAh/60)*6, 0.1);

  else Battery_Life_hours = .;


  /* Device age in months from ReleaseDate to today */

  Device_Age_Months = intck('month', ReleaseDate, today());


  /* Price per GB of RAM (simple affordability metric) */

  if RAM_GB > 0 then Price_per_RAM = round(Price_USD / RAM_GB, 0.01);

  else Price_per_RAM = .;


  /* Create numeric Rating_Scaled 0-100 for easier scoring */

  Rating_Scaled = round(Rating * 20, 1);


  format Battery_Life_hours 6.1 Price_per_RAM 6.2 Rating_Scaled 6.1;

run;

proc print data=work.gadgets;

run;

OUTPUT:

ObsModelBrandCategoryRAM_GBStorage_GBBattery_mAhPrice_USDRatingReleaseDateBattery_Life_hoursDevice_Age_MonthsPrice_per_RAMRating_Scaled
1iPhone 14 ProApplePhone612832009994.62022-09-1648.038166.5092.0
2Galaxy S23SamsungPhone825639008994.52023-02-1758.533112.3890.0
3Pixel 7GooglePhone812843555994.32022-10-1365.33774.8886.0
4MacBook Air M2AppleLaptop8256520011994.72022-07-1569.340149.8894.0
5Dell XPS 13DellLaptop1651260009994.42023-01-2080.03462.4488.0
6ThinkPad X1 CarbonLenovoLaptop161024580012994.52022-09-0577.33881.1990.0
7Apple Watch Series 9AppleSmartwatch1323003994.62023-09-123.626399.0092.0
8Galaxy Watch5SamsungSmartwatch1164102794.22022-08-264.939279.0084.0
9AirPods Pro 2AppleEarbuds11602494.42022-09-236.038249.0088.0
10Surface Pro 9MicrosoftTablet825650009994.12023-10-03.25124.8882.0
11OnePlus 11OnePlusPhone1225650006994.32023-02-0775.03358.2586.0
12Pixel Watch 2GoogleSmartwatch1323062994.02023-05-103.730299.0080.0
13Oppo Find X6OppoPhone1225648007494.12023-03-1572.03262.4282.0
14Huawei MateBook 14HuaweiLaptop1651256008994.02022-11-2574.73656.1980.0
15Bose QC EarbudsBoseEarbuds11602794.22023-04-016.031279.0084.0


3) A macro to compute a composite Performance Score with configurable weights 

%macro perf_score(in=work.gadgets, out=work.gadgets_scored, w_ram=0.25,

                  w_batt=0.30, w_storage=0.15, w_price=0.15, w_rating=0.15);

  data &out.;

    set &in.;


    /* Normalize components to 0-100 before weighting */

    /* We'll use winsorized bounds to reduce effect of outliers */

  /* For simplicity compute theoretical maxs (could be computed dynamically with PROC SQL) */

    max_ram = 16; /* typical upper bound used here */

    max_batt = 6000;

    max_storage = 1024;

    min_price = 199; /* lower bound for normalization */

    max_price = 1299;


    /* Normalize each metric 0-100 */

    ram_norm = min(100, max(0, (RAM_GB / max_ram) * 100));

    batt_norm = min(100, max(0, (Battery_mAh / max_batt) * 100));

    stor_norm = min(100, max(0, (Storage_GB / max_storage) * 100));

    /* For price, lower price is better — invert */

    if Price_USD >= max_price then price_norm = 0;

    else if Price_USD <= min_price then price_norm = 100;

    else price_norm = 100 * (max_price - Price_USD) / (max_price - min_price);


    rating_norm = min(100, max(0, Rating_Scaled));


    /* Composite score */

    Performance_Score = round(ram_norm*&w_ram. + batt_norm*&w_batt. + stor_norm*&w_storage. + price_norm*&w_price. + rating_norm*&w_rating., 0.1);


    label ram_norm = 'RAM (0-100)'

          batt_norm = 'Battery (0-100)'

          stor_norm = 'Storage (0-100)'

          price_norm = 'Price (inverted, 0-100)'

          rating_norm = 'Rating (0-100)'

          Performance_Score = 'Composite Performance Score';

  run;

  proc print;

  run;

%mend perf_score;


4) Run the scoring macro multiple times with different weight sets to show repeated performance scoring 

%perf_score(in=work.gadgets, out=work.gadgets_score_default);

OUTPUT:

ObsModelBrandCategoryRAM_GBStorage_GBBattery_mAhPrice_USDRatingReleaseDateBattery_Life_hoursDevice_Age_MonthsPrice_per_RAMRating_Scaledmax_rammax_battmax_storagemin_pricemax_priceram_normbatt_normstor_normprice_normrating_normPerformance_Score
1iPhone 14 ProApplePhone612832009994.62022-09-1648.038166.5092.01660001024199129937.5053.33312.50027.27279245.1
2Galaxy S23SamsungPhone825639008994.52023-02-1758.533112.3890.01660001024199129950.0065.00025.00036.36369054.7
3Pixel 7GooglePhone812843555994.32022-10-1365.33774.8886.01660001024199129950.0072.58312.50063.63648658.6
4MacBook Air M2AppleLaptop8256520011994.72022-07-1569.340149.8894.01660001024199129950.0086.66725.0009.09099457.7
5Dell XPS 13DellLaptop1651260009994.42023-01-2080.03462.4488.016600010241991299100.00100.00050.00027.27278879.8
6ThinkPad X1 CarbonLenovoLaptop161024580012994.52022-09-0577.33881.1990.016600010241991299100.0096.667100.0000.00009082.5
7Apple Watch Series 9AppleSmartwatch1323003994.62023-09-123.626399.0092.0166000102419912996.255.0003.12581.81829229.6
8Galaxy Watch5SamsungSmartwatch1164102794.22022-08-264.939279.0084.0166000102419912996.256.8331.56392.72738430.4
9AirPods Pro 2AppleEarbuds11602494.42022-09-236.038249.0088.0166000102419912996.251.0000.09895.45458829.4
10Surface Pro 9MicrosoftTablet825650009994.12023-10-03.25124.8882.01660001024199129950.0083.33325.00027.27278257.6
11OnePlus 11OnePlusPhone1225650006994.32023-02-0775.03358.2586.01660001024199129975.0083.33325.00054.54558668.6
12Pixel Watch 2GoogleSmartwatch1323062994.02023-05-103.730299.0080.0166000102419912996.255.1003.12590.90918029.2
13Oppo Find X6OppoPhone1225648007494.12023-03-1572.03262.4282.01660001024199129975.0080.00025.00050.00008266.3
14Huawei MateBook 14HuaweiLaptop1651256008994.02022-11-2574.73656.1980.016600010241991299100.0093.33350.00036.36368078.0
15Bose QC EarbudsBoseEarbuds11602794.22023-04-016.031279.0084.0166000102419912996.251.0000.09892.72738428.4

%perf_score(in=work.gadgets, out=work.gadgets_score_batt_focused, w_ram=0.15, w_batt=0.50, w_storage=0.10, w_price=0.10, w_rating=0.15);

OUTPUT:

ObsModelBrandCategoryRAM_GBStorage_GBBattery_mAhPrice_USDRatingReleaseDateBattery_Life_hoursDevice_Age_MonthsPrice_per_RAMRating_Scaledmax_rammax_battmax_storagemin_pricemax_priceram_normbatt_normstor_normprice_normrating_normPerformance_Score
1iPhone 14 ProApplePhone612832009994.62022-09-1648.038166.5092.01660001024199129937.5053.33312.50027.27279250.1
2Galaxy S23SamsungPhone825639008994.52023-02-1758.533112.3890.01660001024199129950.0065.00025.00036.36369059.6
3Pixel 7GooglePhone812843555994.32022-10-1365.33774.8886.01660001024199129950.0072.58312.50063.63648664.3
4MacBook Air M2AppleLaptop8256520011994.72022-07-1569.340149.8894.01660001024199129950.0086.66725.0009.09099468.3
5Dell XPS 13DellLaptop1651260009994.42023-01-2080.03462.4488.016600010241991299100.00100.00050.00027.27278885.9
6ThinkPad X1 CarbonLenovoLaptop161024580012994.52022-09-0577.33881.1990.016600010241991299100.0096.667100.0000.00009086.8
7Apple Watch Series 9AppleSmartwatch1323003994.62023-09-123.626399.0092.0166000102419912996.255.0003.12581.81829225.7
8Galaxy Watch5SamsungSmartwatch1164102794.22022-08-264.939279.0084.0166000102419912996.256.8331.56392.72738426.4
9AirPods Pro 2AppleEarbuds11602494.42022-09-236.038249.0088.0166000102419912996.251.0000.09895.45458824.2
10Surface Pro 9MicrosoftTablet825650009994.12023-10-03.25124.8882.01660001024199129950.0083.33325.00027.27278266.7
11OnePlus 11OnePlusPhone1225650006994.32023-02-0775.03358.2586.01660001024199129975.0083.33325.00054.54558673.8
12Pixel Watch 2GoogleSmartwatch1323062994.02023-05-103.730299.0080.0166000102419912996.255.1003.12590.90918024.9
13Oppo Find X6OppoPhone1225648007494.12023-03-1572.03262.4282.01660001024199129975.0080.00025.00050.00008271.1
14Huawei MateBook 14HuaweiLaptop1651256008994.02022-11-2574.73656.1980.016600010241991299100.0093.33350.00036.36368082.3
15Bose QC EarbudsBoseEarbuds11602794.22023-04-016.031279.0084.0166000102419912996.251.0000.09892.72738423.3

%perf_score(in=work.gadgets, out=work.gadgets_score_budget_focused, w_ram=0.10, w_batt=0.20, w_storage=0.10, w_price=0.40, w_rating=0.20);

OUTPUT:

ObsModelBrandCategoryRAM_GBStorage_GBBattery_mAhPrice_USDRatingReleaseDateBattery_Life_hoursDevice_Age_MonthsPrice_per_RAMRating_Scaledmax_rammax_battmax_storagemin_pricemax_priceram_normbatt_normstor_normprice_normrating_normPerformance_Score
1iPhone 14 ProApplePhone612832009994.62022-09-1648.038166.5092.01660001024199129937.5053.33312.50027.27279245.0
2Galaxy S23SamsungPhone825639008994.52023-02-1758.533112.3890.01660001024199129950.0065.00025.00036.36369053.0
3Pixel 7GooglePhone812843555994.32022-10-1365.33774.8886.01660001024199129950.0072.58312.50063.63648663.4
4MacBook Air M2AppleLaptop8256520011994.72022-07-1569.340149.8894.01660001024199129950.0086.66725.0009.09099447.3
5Dell XPS 13DellLaptop1651260009994.42023-01-2080.03462.4488.016600010241991299100.00100.00050.00027.27278863.5
6ThinkPad X1 CarbonLenovoLaptop161024580012994.52022-09-0577.33881.1990.016600010241991299100.0096.667100.0000.00009057.3
7Apple Watch Series 9AppleSmartwatch1323003994.62023-09-123.626399.0092.0166000102419912996.255.0003.12581.81829253.1
8Galaxy Watch5SamsungSmartwatch1164102794.22022-08-264.939279.0084.0166000102419912996.256.8331.56392.72738456.0
9AirPods Pro 2AppleEarbuds11602494.42022-09-236.038249.0088.0166000102419912996.251.0000.09895.45458856.6
10Surface Pro 9MicrosoftTablet825650009994.12023-10-03.25124.8882.01660001024199129950.0083.33325.00027.27278251.5
11OnePlus 11OnePlusPhone1225650006994.32023-02-0775.03358.2586.01660001024199129975.0083.33325.00054.54558665.7
12Pixel Watch 2GoogleSmartwatch1323062994.02023-05-103.730299.0080.0166000102419912996.255.1003.12590.90918054.3
13Oppo Find X6OppoPhone1225648007494.12023-03-1572.03262.4282.01660001024199129975.0080.00025.00050.00008262.4
14Huawei MateBook 14HuaweiLaptop1651256008994.02022-11-2574.73656.1980.016600010241991299100.0093.33350.00036.36368064.2
15Bose QC EarbudsBoseEarbuds11602794.22023-04-016.031279.0084.0166000102419912996.251.0000.09892.72738454.7


5) Use PROC RANK to create rank order by Performance_Score

proc rank data=work.gadgets_score_default out=work.gadgets_ranked_default ties=low descending;

  var Performance_Score;

  ranks Perf_Rank_Default;

run;

proc print data=work.gadgets_ranked_default;

run;

OUTPUT:

ObsModelBrandCategoryRAM_GBStorage_GBBattery_mAhPrice_USDRatingReleaseDateBattery_Life_hoursDevice_Age_MonthsPrice_per_RAMRating_Scaledmax_rammax_battmax_storagemin_pricemax_priceram_normbatt_normstor_normprice_normrating_normPerformance_ScorePerf_Rank_Default
1iPhone 14 ProApplePhone612832009994.62022-09-1648.038166.5092.01660001024199129937.5053.33312.50027.27279245.110
2Galaxy S23SamsungPhone825639008994.52023-02-1758.533112.3890.01660001024199129950.0065.00025.00036.36369054.79
3Pixel 7GooglePhone812843555994.32022-10-1365.33774.8886.01660001024199129950.0072.58312.50063.63648658.66
4MacBook Air M2AppleLaptop8256520011994.72022-07-1569.340149.8894.01660001024199129950.0086.66725.0009.09099457.77
5Dell XPS 13DellLaptop1651260009994.42023-01-2080.03462.4488.016600010241991299100.00100.00050.00027.27278879.82
6ThinkPad X1 CarbonLenovoLaptop161024580012994.52022-09-0577.33881.1990.016600010241991299100.0096.667100.0000.00009082.51
7Apple Watch Series 9AppleSmartwatch1323003994.62023-09-123.626399.0092.0166000102419912996.255.0003.12581.81829229.612
8Galaxy Watch5SamsungSmartwatch1164102794.22022-08-264.939279.0084.0166000102419912996.256.8331.56392.72738430.411
9AirPods Pro 2AppleEarbuds11602494.42022-09-236.038249.0088.0166000102419912996.251.0000.09895.45458829.413
10Surface Pro 9MicrosoftTablet825650009994.12023-10-03.25124.8882.01660001024199129950.0083.33325.00027.27278257.68
11OnePlus 11OnePlusPhone1225650006994.32023-02-0775.03358.2586.01660001024199129975.0083.33325.00054.54558668.64
12Pixel Watch 2GoogleSmartwatch1323062994.02023-05-103.730299.0080.0166000102419912996.255.1003.12590.90918029.214
13Oppo Find X6OppoPhone1225648007494.12023-03-1572.03262.4282.01660001024199129975.0080.00025.00050.00008266.35
14Huawei MateBook 14HuaweiLaptop1651256008994.02022-11-2574.73656.1980.016600010241991299100.0093.33350.00036.36368078.03
15Bose QC EarbudsBoseEarbuds11602794.22023-04-016.031279.0084.0166000102419912996.251.0000.09892.72738428.415


proc rank data=work.gadgets_score_batt_focused out=work.gadgets_ranked_batt ties=low descending;

  var Performance_Score;

  ranks Perf_Rank_Batt;

run;

proc print data=work.gadgets_ranked_batt;

run;

OUTPUT:

ObsModelBrandCategoryRAM_GBStorage_GBBattery_mAhPrice_USDRatingReleaseDateBattery_Life_hoursDevice_Age_MonthsPrice_per_RAMRating_Scaledmax_rammax_battmax_storagemin_pricemax_priceram_normbatt_normstor_normprice_normrating_normPerformance_ScorePerf_Rank_Batt
1iPhone 14 ProApplePhone612832009994.62022-09-1648.038166.5092.01660001024199129937.5053.33312.50027.27279250.110
2Galaxy S23SamsungPhone825639008994.52023-02-1758.533112.3890.01660001024199129950.0065.00025.00036.36369059.69
3Pixel 7GooglePhone812843555994.32022-10-1365.33774.8886.01660001024199129950.0072.58312.50063.63648664.38
4MacBook Air M2AppleLaptop8256520011994.72022-07-1569.340149.8894.01660001024199129950.0086.66725.0009.09099468.36
5Dell XPS 13DellLaptop1651260009994.42023-01-2080.03462.4488.016600010241991299100.00100.00050.00027.27278885.92
6ThinkPad X1 CarbonLenovoLaptop161024580012994.52022-09-0577.33881.1990.016600010241991299100.0096.667100.0000.00009086.81
7Apple Watch Series 9AppleSmartwatch1323003994.62023-09-123.626399.0092.0166000102419912996.255.0003.12581.81829225.712
8Galaxy Watch5SamsungSmartwatch1164102794.22022-08-264.939279.0084.0166000102419912996.256.8331.56392.72738426.411
9AirPods Pro 2AppleEarbuds11602494.42022-09-236.038249.0088.0166000102419912996.251.0000.09895.45458824.214
10Surface Pro 9MicrosoftTablet825650009994.12023-10-03.25124.8882.01660001024199129950.0083.33325.00027.27278266.77
11OnePlus 11OnePlusPhone1225650006994.32023-02-0775.03358.2586.01660001024199129975.0083.33325.00054.54558673.84
12Pixel Watch 2GoogleSmartwatch1323062994.02023-05-103.730299.0080.0166000102419912996.255.1003.12590.90918024.913
13Oppo Find X6OppoPhone1225648007494.12023-03-1572.03262.4282.01660001024199129975.0080.00025.00050.00008271.15
14Huawei MateBook 14HuaweiLaptop1651256008994.02022-11-2574.73656.1980.016600010241991299100.0093.33350.00036.36368082.33
15Bose QC EarbudsBoseEarbuds11602794.22023-04-016.031279.0084.0166000102419912996.251.0000.09892.72738423.315

6) Summary statistics with PROC MEANS and PROC UNIVARIATE 

proc means data=work.gadgets_score_default mean median std min max n;

  var RAM_GB Storage_GB Battery_mAh Battery_Life_hours Price_USD Rating_Scaled Performance_Score;

  title 'Numeric Summary: GADGETS (Default Performance Score)';

run;

OUTPUT:

Numeric Summary: GADGETS (Default Performance Score)

The MEANS Procedure

VariableLabelMeanMedianStd DevMinimumMaximumN
RAM_GB
Storage_GB
Battery_mAh
Battery_Life_hours
Price_USD
Rating_Scaled
Performance_Score
 
 
 
 
 
 
Composite Performance Score
7.6666667
244.4000000
3332.73
46.0214286
723.0000000
86.5333333
53.0600000
8.0000000
256.0000000
4355.00
61.9000000
749.0000000
86.0000000
57.6000000
5.8022984
272.5078767
2379.20
32.8496149
355.4835741
4.5018515
19.9292965
1.0000000
1.0000000
60.0000000
3.6000000
249.0000000
80.0000000
28.4000000
16.0000000
1024.00
6000.00
80.0000000
1299.00
94.0000000
82.5000000
15
15
15
14
15
15
15

proc univariate data=work.gadgets_score_default;

  var Performance_Score Price_USD Battery_Life_hours;

  histogram Performance_Score / normal;

  inset mean std median / position=ne;

  title 'Univariate Analysis for Key Metrics';

run;

title;

OUTPUT:

Univariate Analysis for Key Metrics

The UNIVARIATE Procedure

Variable: Performance_Score (Composite Performance Score)

Moments
N15Sum Weights15
Mean53.06Sum Observations795.9
Std Deviation19.9292965Variance397.176857
Skewness-0.0029729Kurtosis-1.4578113
Uncorrected SS47790.93Corrected SS5560.476
Coeff Variation37.5599255Std Error Mean5.14572222
Basic Statistical Measures
LocationVariability
Mean53.06000Std Deviation19.92930
Median57.60000Variance397.17686
Mode.Range54.10000
  Interquartile Range39.00000
Tests for Location: Mu0=0
TestStatisticp Value
Student's tt10.31148Pr > |t|<.0001
SignM7.5Pr >= |M|<.0001
Signed RankS60Pr >= |S|<.0001
Quantiles (Definition 5)
LevelQuantile
100% Max82.5
99%82.5
95%82.5
90%79.8
75% Q368.6
50% Median57.6
25% Q129.6
10%29.2
5%28.4
1%28.4
0% Min28.4
Extreme Observations
LowestHighest
ValueObsValueObs
28.41566.313
29.21268.611
29.4978.014
29.6779.85
30.4882.56

Univariate Analysis for Key Metrics

The UNIVARIATE Procedure

Histogram for Performance_Score

Univariate Analysis for Key Metrics

The UNIVARIATE Procedure

Fitted Normal Distribution for Performance_Score (Composite Performance Score)

Parameters for Normal Distribution
ParameterSymbolEstimate
MeanMu53.06
Std DevSigma19.9293
Goodness-of-Fit Tests for Normal Distribution
TestStatisticp Value
Kolmogorov-SmirnovD0.20556828Pr > D0.087
Cramer-von MisesW-Sq0.08370795Pr > W-Sq0.176
Anderson-DarlingA-Sq0.61317932Pr > A-Sq0.092
Quantiles for Normal Distribution
PercentQuantile
ObservedEstimated
1.028.40006.69752
5.028.400020.27922
10.029.200027.51958
25.029.600039.61789
50.057.600053.06000
75.068.600066.50211
90.079.800078.60042
95.082.500085.84078
99.082.500099.42248

Univariate Analysis for Key Metrics

The UNIVARIATE Procedure

Variable: Price_USD

Moments
N15Sum Weights15
Mean723Sum Observations10845
Std Deviation355.483574Variance126368.571
Skewness-0.0380933Kurtosis-1.3433761
Uncorrected SS9610095Corrected SS1769160
Coeff Variation49.1678526Std Error Mean91.7854641
Basic Statistical Measures
LocationVariability
Mean723.0000Std Deviation355.48357
Median749.0000Variance126369
Mode999.0000Range1050
  Interquartile Range700.00000
Tests for Location: Mu0=0
TestStatisticp Value
Student's tt7.877064Pr > |t|<.0001
SignM7.5Pr >= |M|<.0001
Signed RankS60Pr >= |S|<.0001
Quantiles (Definition 5)
LevelQuantile
100% Max1299
99%1299
95%1299
90%1199
75% Q3999
50% Median749
25% Q1299
10%279
5%249
1%249
0% Min249
Extreme Observations
LowestHighest
ValueObsValueObs
24999991
279159995
279899910
2991211994
399712996

Univariate Analysis for Key Metrics

The UNIVARIATE Procedure

Variable: Battery_Life_hours

Moments
N14Sum Weights14
Mean46.0214286Sum Observations644.3
Std Deviation32.8496149Variance1079.0972
Skewness-0.4882833Kurtosis-1.8419884
Uncorrected SS43679.87Corrected SS14028.2636
Coeff Variation71.3789552Std Error Mean8.77942887
Basic Statistical Measures
LocationVariability
Mean46.02143Std Deviation32.84961
Median61.90000Variance1079
Mode6.00000Range76.40000
  Interquartile Range68.70000
Tests for Location: Mu0=0
TestStatisticp Value
Student's tt5.241962Pr > |t|0.0002
SignM7Pr >= |M|0.0001
Signed RankS52.5Pr >= |S|0.0001
Quantiles (Definition 5)
LevelQuantile
100% Max80.0
99%80.0
95%80.0
90%77.3
75% Q374.7
50% Median61.9
25% Q16.0
10%3.7
5%3.6
1%3.6
0% Min3.6
Extreme Observations
LowestHighest
ValueObsValueObs
3.6772.013
3.71274.714
4.9875.011
6.01577.36
6.0980.05
Missing Values
Missing
Value
CountPercent Of
All ObsMissing Obs
.16.67100.00

7) PROC SQL examples: Top 5 by default performance score and average price by category */

proc sql outobs=5;

  create table work.top5_default as

  select Model, Brand, Category, Performance_Score, Price_USD

  from work.gadgets_ranked_default

  order by Perf_Rank_Default;


  create table work.avg_price_by_cat as

  select Category, count(*) as Count, mean(Price_USD) as Avg_Price format=8.2

  from work.gadgets_score_default

  group by Category;

quit;

proc print data=work.top5_default;

run;

OUTPUT:

ObsModelBrandCategoryPerformance_ScorePrice_USD
1ThinkPad X1 CarbonLenovoLaptop82.51299
2Dell XPS 13DellLaptop79.8999
3Huawei MateBook 14HuaweiLaptop78.0899
4OnePlus 11OnePlusPhone68.6699
5Oppo Find X6OppoPhone66.3749

proc print data=work.avg_price_by_cat;

run;

OUTPUT:

ObsCategoryCountAvg_Price
1Earbuds2264.00
2Laptop41099.00
3Phone5789.00
4Smartwatch3325.67
5Tablet1999.00


8) Visualizations using PROC SGPLOT 

proc sgplot data=work.gadgets_score_default;

  scatter x=Price_USD y=Performance_Score / datalabel=Model markerattrs=(symbol=CircleFilled);

  reg x=Price_USD y=Performance_Score; /* trend line */

  xaxis label='Price (USD)';

  yaxis label='Performance Score (0-100)';

  title 'Price vs Performance Score';

run;

OUTPUT:

The SGPlot Procedure

proc sgplot data=work.gadgets_score_default;

  vbar Category / response=Performance_Score stat=mean datalabel;

  title 'Average Performance Score by Category';

run;

OUTPUT:

The SGPlot Procedure


9) Demonstrate INTCK usage again — months since release for reporting 

proc sql;

  create table work.age_report as

  select Model, Brand, Category, ReleaseDate, 

         intck('month', ReleaseDate, today()) as Age_Months

  from work.gadgets_score_default

  order by Age_Months desc;

quit;

proc print data=work.age_report;

run;

OUTPUT:
ObsModelBrandCategoryReleaseDateAge_Months
1MacBook Air M2AppleLaptop2022-07-1540
2Galaxy Watch5SamsungSmartwatch2022-08-2639
3ThinkPad X1 CarbonLenovoLaptop2022-09-0538
4iPhone 14 ProApplePhone2022-09-1638
5AirPods Pro 2AppleEarbuds2022-09-2338
6Pixel 7GooglePhone2022-10-1337
7Huawei MateBook 14HuaweiLaptop2022-11-2536
8Dell XPS 13DellLaptop2023-01-2034
9Galaxy S23SamsungPhone2023-02-1733
10OnePlus 11OnePlusPhone2023-02-0733
11Oppo Find X6OppoPhone2023-03-1532
12Bose QC EarbudsBoseEarbuds2023-04-0131
13Pixel Watch 2GoogleSmartwatch2023-05-1030
14Apple Watch Series 9AppleSmartwatch2023-09-1226
15Surface Pro 9MicrosoftTablet2023-10-0325




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  



Follow Us On : 


 


--- FOLLOW OUR BLOG FOR MORE INFORMATION.

--->PLEASE DO COMMENTS AND SHARE OUR BLOG.



No comments:

Post a Comment