233.ANALYZING BEST BIKES WORLDWIDE USING PROC CONTENTS | PROC PRINT | PROC SORT | PROC MEANS | PROC FREQ | PROC UNIVARIATE | PROC SQL | PROC REPORT | PROC TABULATE | PROC SGPLOT | MACROS IN SAS

ANALYZING BEST BIKES WORLDWIDE USING PROC CONTENTS | PROC PRINT | PROC SORT | PROC MEANS | PROC FREQ | PROC UNIVARIATE | PROC SQL | PROC REPORT | PROC TABULATE | PROC SGPLOT | MACROS IN SAS

/*Creating A Dataset Of Best Bikes  Worldwide */

1.Option settings

options nocenter fullstimer yearcutoff=1950 errors=3 dkricond=error;        

                

2.User‑defined formats

proc format;

   value $typefmt

      'Motorcycle' = 'MOTOR‑CYCLE'

      'Bicycle'    = 'BICYCLE (Pedal / e‑assist)';

   value engsize

      low‑<200   = 'A: <200 cc'

      200‑<600   = 'B: 200‑599 cc'

      600‑<1000  = 'C: 600‑999 cc'

      1000‑high  = 'D: ≥1000 cc';

run;


3.DATA step: build the core table

data work.best_bikes;

   infile datalines dsd dlm='|' truncover;

   length Brand $15 Model $30 Segment $15 Country_Origin $12 Type $10;

   input

      BikeID            : 8.

      Brand             : $15.

      Model             : $30.

      Type              : $10.

      Segment           : $15.

      Engine_CC         : 8.

      Power_HP          : 8.

      Torque_Nm         : 8.

      Weight_kg         : 8.

      Top_Speed_kmh     : ?? 8.

      Price_USD         : comma8.

      Country_Origin    : $12.

      Rating            : 4.1

      Year_Released     : 4.

      Units_Sold_2024   : comma8.;


   if Power_HP>0 and Weight_kg>0 then HP_per_kg = round(Power_HP/Weight_kg,0.001);

   Model_Age = year(today()) - Year_Released;

   format Price_USD comma10.

          HP_per_kg 6.3

          Rating    3.1

          Type      $typefmt.

          Engine_CC engsize.;

datalines;

1|Honda|CBR1000RR‑R Fireblade SP|Motorcycle|Supersport|1000|214|113|201|322|28000|Japan|9.5|2024|3,500

2|Yamaha|YZF‑R1M|Motorcycle|Supersport|998|200|112|200|299|26000|Japan|9.4|2023|4,200

3|Ducati|Panigale V4 S|Motorcycle|Supersport|1103|214|124|198|306|32000|Italy|9.6|2024|3,700

4|Kawasaki|Ninja H2R|Motorcycle|Hyperbike|998|310|165|216|400|55000|Japan|9.7|2022|800

5|BMW|S1000RR|Motorcycle|Supersport|999|205|113|197|299|25000|Germany|9.3|2024|4,100

6|KTM|1290 Super Duke R|Motorcycle|Naked|1301|180|140|189|289|19000|Austria|9.2|2023|2,900

7|Triumph|Street Triple 765 RS|Motorcycle|Naked|765|128|80|166|241|15000|UK|9.0|2023|3,300

8|Harley‑Davidson|Pan America 1250|Motorcycle|Adventure|1252|150|128|239|225|18000|USA|8.8|2024|2,500

9|Royal Enfield|Himalayan 450|Motorcycle|Adventure|452|40|45|199|143|6,500|India|8.4|2024|50,000

10|Bajaj|Pulsar N250|Motorcycle|Street|249|25|21|162|132|2,300|India|8.2|2023|120,000

11|Giant|TCR Advanced SL 0 Disk|Bicycle|Road|0|0|0|6.7|‑‑|11,200|Taiwan|9.1|2024|1,500

12|Specialized|S‑Works Tarmac SL8|Bicycle|Road|0|0|0|6.6|‑‑|14,500|USA|9.5|2024|2,000

13|Trek|Madone SLR 9|Bicycle|Road|0|0|0|7.1|‑‑|13,000|USA|9.4|2024|1,800

14|Cervélo|Caledonia‑5|Bicycle|Endurance|0|0|0|7.8|‑‑|10,500|Canada|9.0|2023|1,600

15|Santa Cruz|V10|Bicycle|Mountain|0|0|0|15.3|‑‑|10,500|USA|8.9|2022|1,000

16|Canyon|Spectral Mullet|Bicycle|Mountain|0|0|0|14.2|‑‑|6,400|Germany|8.8|2023|2,100

17|Scott|Spark RC SL|Bicycle|XC|0|0|0|10.2|‑‑|12,000|Switzerland|9.2|2024|900

18|Yeti|SB160|Bicycle|Enduro|0|0|0|14.7|‑‑|9,500|USA|8.7|2024|800

19|Orbea|Gain M20i|Bicycle|E‑Road|0|0|0|11.3|‑‑|6,300|Spain|8.6|2023|1,000

20|Specialized|Turbo Levo SL Comp|Bicycle|E‑MTB|0|0|0|17.9|‑‑|7,500|USA|8.9|2024|1,200

21|Bajaj|Dominar 400|Motorcycle|Sport‑Touring|373|40|35|182|156|3,000|India|8.3|2024|45,000

22|Suzuki|Hayabusa|Motorcycle|Hyperbike|1340|190|150|264|299|28,000|Japan|9.0|2023|6,000

23|Aprilia|RSV4 Factory|Motorcycle|Supersport|1099|217|125|199|305|34,000|Italy|9.4|2024|2,000

24|MV Agusta|Brutale 1000 RR|Motorcycle|Naked|998|208|117|186|299|35,000|Italy|9.3|2023|900

25|Hero|Splendor Plus|Motorcycle|Commuter|97|8|8|112|96|1,000|India|7.8|2024|280,000

26|KTM|RC 390|Motorcycle|Supersport|373|44|37|172|178|5,100|Austria|8.5|2024|22,000

27|Lectric|XP 3.0|Bicycle|E‑Bike|0|0|0|23.6|‑‑|999|USA|8.0|2024|35,000

28|Brompton|C Line Explore|Bicycle|Folding|0|0|0|11.6|‑‑|1,750|UK|8.2|2023|12,000

29|BMW|R1300GS|Motorcycle|Adventure|1300|145|143|239|225|20,500|Germany|9.1|2025|1,000

30|Ducati|DesertX|Motorcycle|Adventure|937|110|92|223|242|17,000|Italy|8.9|2024|1,900

;

run;

proc print;

run;

Output:

Obs Brand Model Segment Country_Origin Type BikeID Engine_CC Power_HP Torque_Nm Weight_kg Top_Speed_kmh Price_USD Rating Year_Released Units_Sold_2024 HP_per_kg Model_Age
1 Honda CBR1000RR-R Fireblade SP Supersport Japan MOTOR-CYCLE 1 D: =1000 cc 214 113 201.0 322 28,000 9.5 2024 3500 1.065 -9
2 Yamaha YZF-R1M Supersport Japan MOTOR-CYCLE 2 C: 600-999 cc 200 112 200.0 299 26,000 9.4 2023 4200 1.000 -8
3 Ducati Panigale V4 S Supersport Italy MOTOR-CYCLE 3 D: =1000 cc 214 124 198.0 306 32,000 9.6 2024 3700 1.081 -9
4 Kawasaki Ninja H2R Hyperbike Japan MOTOR-CYCLE 4 C: 600-999 cc 310 165 216.0 400 55,000 9.7 2022 800 1.435 -7
5 BMW S1000RR Supersport Germany MOTOR-CYCLE 5 C: 600-999 cc 205 113 197.0 299 25,000 9.3 2024 4100 1.041 -9
6 KTM 1290 Super Duke R Naked Austria MOTOR-CYCLE 6 D: =1000 cc 180 140 189.0 289 19,000 9.2 2023 2900 0.952 -8
7 Triumph Street Triple 765 RS Naked UK MOTOR-CYCLE 7 C: 600-999 cc 128 80 166.0 241 15,000 9.0 2023 3300 0.771 -8
8 Harley-Davidson Pan America 1250 Adventure USA MOTOR-CYCLE 8 D: =1000 cc 150 128 239.0 225 18,000 8.8 2024 2500 0.628 -9
9 Royal Enfield Himalayan 450 Adventure India MOTOR-CYCLE 9 B: 200-599 cc 40 45 199.0 143 6,500 8.4 2024 50000 0.201 -9
10 Bajaj Pulsar N250 Street India MOTOR-CYCLE 10 B: 200-599 cc 25 21 162.0 132 2,300 8.2 2023 120000 0.154 -8
11 Giant TCR Advanced SL 0 Disk Road Taiwan BICYCLE (Pedal / e-assist) 11 A: <200 cc 0 0 6.7 . 11,200 9.1 2024 1500 . -9
12 Specialized S-Works Tarmac SL8 Road USA BICYCLE (Pedal / e-assist) 12 A: <200 cc 0 0 6.6 . 14,500 9.5 2024 2000 . -9
13 Trek Madone SLR 9 Road USA BICYCLE (Pedal / e-assist) 13 A: <200 cc 0 0 7.1 . 13,000 9.4 2024 1800 . -9
14 Cervélo Caledonia-5 Endurance Canada BICYCLE (Pedal / e-assist) 14 A: <200 cc 0 0 7.8 . 10,500 9.0 2023 1600 . -8
15 Santa Cruz V10 Mountain USA BICYCLE (Pedal / e-assist) 15 A: <200 cc 0 0 15.3 . 10,500 8.9 2022 1000 . -7
16 Canyon Spectral Mullet Mountain Germany BICYCLE (Pedal / e-assist) 16 A: <200 cc 0 0 14.2 . 6,400 8.8 2023 2100 . -8
17 Scott Spark RC SL XC Switzerland BICYCLE (Pedal / e-assist) 17 A: <200 cc 0 0 10.2 . 12,000 9.2 2024 900 . -9
18 Yeti SB160 Enduro USA BICYCLE (Pedal / e-assist) 18 A: <200 cc 0 0 14.7 . 9,500 8.7 2024 800 . -9
19 Orbea Gain M20i E-Road Spain BICYCLE (Pedal / e-assist) 19 A: <200 cc 0 0 11.3 . 6,300 8.6 2023 1000 . -8
20 Specialized Turbo Levo SL Comp E-MTB USA BICYCLE (Pedal / e-assist) 20 A: <200 cc 0 0 17.9 . 7,500 8.9 2024 1200 . -9
21 Bajaj Dominar 400 Sport-Touring India MOTOR-CYCLE 21 B: 200-599 cc 40 35 182.0 156 3,000 8.3 2024 45000 0.220 -9
22 Suzuki Hayabusa Hyperbike Japan MOTOR-CYCLE 22 D: =1000 cc 190 150 264.0 299 28,000 9.0 2023 6000 0.720 -8
23 Aprilia RSV4 Factory Supersport Italy MOTOR-CYCLE 23 D: =1000 cc 217 125 199.0 305 34,000 9.4 2024 2000 1.090 -9
24 MV Agusta Brutale 1000 RR Naked Italy MOTOR-CYCLE 24 C: 600-999 cc 208 117 186.0 299 35,000 9.3 2023 900 1.118 -8
25 Hero Splendor Plus Commuter India MOTOR-CYCLE 25 A: <200 cc 8 8 112.0 96 1,000 7.8 2024 280000 0.071 -9
26 KTM RC 390 Supersport Austria MOTOR-CYCLE 26 B: 200-599 cc 44 37 172.0 178 5,100 8.5 2024 22000 0.256 -9
27 Lectric XP 3.0 E-Bike USA BICYCLE (Pedal / e-assist) 27 A: <200 cc 0 0 23.6 . 999 8.0 2024 35000 . -9
28 Brompton C Line Explore Folding UK BICYCLE (Pedal / e-assist) 28 A: <200 cc 0 0 11.6 . 1,750 8.2 2023 12000 . -8
29 BMW R1300GS Adventure Germany MOTOR-CYCLE 29 D: =1000 cc 145 143 239.0 225 20,500 9.1 2025 1000 0.607 -10
30 Ducati DesertX Adventure Italy MOTOR-CYCLE 30 C: 600-999 cc 110 92 223.0 242 17,000 8.9 2024 1900 0.493 -9


4.Quick metadata scan

proc contents data=work.best_bikes varnum;

   title "Structure of BEST_BIKES Dataset";

run;

 Output:

Structure of BEST_BIKES Dataset

The CONTENTS Procedure

Data Set Name WORK.BEST_BIKES Observations 30
Member Type DATA Variables 17
Engine V9 Indexes 0
Created 14/09/2015 00:25:54 Observation Length 184
Last Modified 14/09/2015 00:25:54 Deleted Observations 0
Protection   Compressed NO
Data Set Type   Sorted NO
Label      
Data Representation WINDOWS_64    
Encoding wlatin1 Western (Windows)    


Engine/Host Dependent Information
Data Set Page Size 65536
Number of Data Set Pages 1
First Data Page 1
Max Obs per Page 355
Obs in First Data Page 30
Number of Data Set Repairs 0
ExtendObsCounter YES
Filename C:\Users\Lenovo\AppData\Local\Temp\SAS Temporary Files\_TD11048_DESKTOP-QFAA4KV_\best_bikes.sas7bdat
Release Created 9.0401M2
Host Created X64_8HOME


Variables in Creation Order
# Variable Type Len Format
1 Brand Char 15  
2 Model Char 30  
3 Segment Char 15  
4 Country_Origin Char 12  
5 Type Char 10 $TYPEFMT.
6 BikeID Num 8  
7 Engine_CC Num 8 ENGSIZE.
8 Power_HP Num 8  
9 Torque_Nm Num 8  
10 Weight_kg Num 8  
11 Top_Speed_kmh Num 8  
12 Price_USD Num 8 COMMA10.
13 Rating Num 8 3.1
14 Year_Released Num 8  
15 Units_Sold_2024 Num 8  
16 HP_per_kg Num 8 6.3
17 Model_Age Num 8  


5.Snapshot listing

proc print data=work.best_bikes (obs=10) label;

   var Brand Model Type Price_USD Rating;

   title "First 10 Bikes — Sanity Check";

run;

Output:

First 10 Bikes — Sanity Check

Obs Brand Model Type Price_USD Rating
1 Honda CBR1000RR-R Fireblade SP MOTOR-CYCLE 28,000 9.5
2 Yamaha YZF-R1M MOTOR-CYCLE 26,000 9.4
3 Ducati Panigale V4 S MOTOR-CYCLE 32,000 9.6
4 Kawasaki Ninja H2R MOTOR-CYCLE 55,000 9.7
5 BMW S1000RR MOTOR-CYCLE 25,000 9.3
6 KTM 1290 Super Duke R MOTOR-CYCLE 19,000 9.2
7 Triumph Street Triple 765 RS MOTOR-CYCLE 15,000 9.0
8 Harley-Davidson Pan America 1250 MOTOR-CYCLE 18,000 8.8
9 Royal Enfield Himalayan 450 MOTOR-CYCLE 6,500 8.4
10 Bajaj Pulsar N250 MOTOR-CYCLE 2,300 8.2


6.Sorting & descriptive stats

proc sort data=work.best_bikes out=price_ranked;

   by descending Price_USD;

run;

proc print;run;

Output:

Obs Brand Model Segment Country_Origin Type BikeID Engine_CC Power_HP Torque_Nm Weight_kg Top_Speed_kmh Price_USD Rating Year_Released Units_Sold_2024 HP_per_kg Model_Age
1 Kawasaki Ninja H2R Hyperbike Japan MOTOR-CYCLE 4 C: 600-999 cc 310 165 216.0 400 55,000 9.7 2022 800 1.435 -7
2 MV Agusta Brutale 1000 RR Naked Italy MOTOR-CYCLE 24 C: 600-999 cc 208 117 186.0 299 35,000 9.3 2023 900 1.118 -8
3 Aprilia RSV4 Factory Supersport Italy MOTOR-CYCLE 23 D: =1000 cc 217 125 199.0 305 34,000 9.4 2024 2000 1.090 -9
4 Ducati Panigale V4 S Supersport Italy MOTOR-CYCLE 3 D: =1000 cc 214 124 198.0 306 32,000 9.6 2024 3700 1.081 -9
5 Honda CBR1000RR-R Fireblade SP Supersport Japan MOTOR-CYCLE 1 D: =1000 cc 214 113 201.0 322 28,000 9.5 2024 3500 1.065 -9
6 Suzuki Hayabusa Hyperbike Japan MOTOR-CYCLE 22 D: =1000 cc 190 150 264.0 299 28,000 9.0 2023 6000 0.720 -8
7 Yamaha YZF-R1M Supersport Japan MOTOR-CYCLE 2 C: 600-999 cc 200 112 200.0 299 26,000 9.4 2023 4200 1.000 -8
8 BMW S1000RR Supersport Germany MOTOR-CYCLE 5 C: 600-999 cc 205 113 197.0 299 25,000 9.3 2024 4100 1.041 -9
9 BMW R1300GS Adventure Germany MOTOR-CYCLE 29 D: =1000 cc 145 143 239.0 225 20,500 9.1 2025 1000 0.607 -10
10 KTM 1290 Super Duke R Naked Austria MOTOR-CYCLE 6 D: =1000 cc 180 140 189.0 289 19,000 9.2 2023 2900 0.952 -8
11 Harley-Davidson Pan America 1250 Adventure USA MOTOR-CYCLE 8 D: =1000 cc 150 128 239.0 225 18,000 8.8 2024 2500 0.628 -9
12 Ducati DesertX Adventure Italy MOTOR-CYCLE 30 C: 600-999 cc 110 92 223.0 242 17,000 8.9 2024 1900 0.493 -9
13 Triumph Street Triple 765 RS Naked UK MOTOR-CYCLE 7 C: 600-999 cc 128 80 166.0 241 15,000 9.0 2023 3300 0.771 -8
14 Specialized S-Works Tarmac SL8 Road USA BICYCLE (Pedal / e-assist) 12 A: <200 cc 0 0 6.6 . 14,500 9.5 2024 2000 . -9
15 Trek Madone SLR 9 Road USA BICYCLE (Pedal / e-assist) 13 A: <200 cc 0 0 7.1 . 13,000 9.4 2024 1800 . -9
16 Scott Spark RC SL XC Switzerland BICYCLE (Pedal / e-assist) 17 A: <200 cc 0 0 10.2 . 12,000 9.2 2024 900 . -9
17 Giant TCR Advanced SL 0 Disk Road Taiwan BICYCLE (Pedal / e-assist) 11 A: <200 cc 0 0 6.7 . 11,200 9.1 2024 1500 . -9
18 Cervélo Caledonia-5 Endurance Canada BICYCLE (Pedal / e-assist) 14 A: <200 cc 0 0 7.8 . 10,500 9.0 2023 1600 . -8
19 Santa Cruz V10 Mountain USA BICYCLE (Pedal / e-assist) 15 A: <200 cc 0 0 15.3 . 10,500 8.9 2022 1000 . -7
20 Yeti SB160 Enduro USA BICYCLE (Pedal / e-assist) 18 A: <200 cc 0 0 14.7 . 9,500 8.7 2024 800 . -9
21 Specialized Turbo Levo SL Comp E-MTB USA BICYCLE (Pedal / e-assist) 20 A: <200 cc 0 0 17.9 . 7,500 8.9 2024 1200 . -9
22 Royal Enfield Himalayan 450 Adventure India MOTOR-CYCLE 9 B: 200-599 cc 40 45 199.0 143 6,500 8.4 2024 50000 0.201 -9
23 Canyon Spectral Mullet Mountain Germany BICYCLE (Pedal / e-assist) 16 A: <200 cc 0 0 14.2 . 6,400 8.8 2023 2100 . -8
24 Orbea Gain M20i E-Road Spain BICYCLE (Pedal / e-assist) 19 A: <200 cc 0 0 11.3 . 6,300 8.6 2023 1000 . -8
25 KTM RC 390 Supersport Austria MOTOR-CYCLE 26 B: 200-599 cc 44 37 172.0 178 5,100 8.5 2024 22000 0.256 -9
26 Bajaj Dominar 400 Sport-Touring India MOTOR-CYCLE 21 B: 200-599 cc 40 35 182.0 156 3,000 8.3 2024 45000 0.220 -9
27 Bajaj Pulsar N250 Street India MOTOR-CYCLE 10 B: 200-599 cc 25 21 162.0 132 2,300 8.2 2023 120000 0.154 -8
28 Brompton C Line Explore Folding UK BICYCLE (Pedal / e-assist) 28 A: <200 cc 0 0 11.6 . 1,750 8.2 2023 12000 . -8
29 Hero Splendor Plus Commuter India MOTOR-CYCLE 25 A: <200 cc 8 8 112.0 96 1,000 7.8 2024 280000 0.071 -9
30 Lectric XP 3.0 E-Bike USA BICYCLE (Pedal / e-assist) 27 A: <200 cc 0 0 23.6 . 999 8.0 2024 35000 . -9


proc means data=work.best_bikes

           n nmiss min p25 median mean p75 max std

           maxdec=1;

   class Type;

   var Price_USD Engine_CC Power_HP Weight_kg;

   title "Descriptive Statistics by Bike Type";

run;

Output:

Descriptive Statistics by Bike Type

The MEANS Procedure

Type N Obs Variable N N Miss Minimum 25th Pctl Median Mean 75th Pctl Maximum Std Dev
BICYCLE (Pedal / e-assist) 12
Price_USD
Engine_CC
Power_HP
Weight_kg
12
12
12
12
0
0
0
0
999.0
0.0
0.0
6.6
6350.0
0.0
0.0
7.5
10000.0
0.0
0.0
11.5
8679.1
0.0
0.0
12.3
11600.0
0.0
0.0
15.0
14500.0
0.0
0.0
23.6
4226.4
0.0
0.0
5.2
MOTOR-CYCLE 18
Price_USD
Engine_CC
Power_HP
Weight_kg
18
18
18
18
0
0
0
0
1000.0
97.0
8.0
112.0
6500.0
452.0
44.0
182.0
19750.0
998.0
165.0
198.5
20577.8
868.6
146.0
196.9
28000.0
1103.0
208.0
216.0
55000.0
1340.0
310.0
264.0
14100.0
390.6
85.0
33.9


7.Frequency & univariate exploration

proc freq data=work.best_bikes;

   tables Type*Segment / nocum nopercent;

   format Engine_CC engsize.;

   title "Cross‑tab of Segment within Type";

run;

Output:

Cross-tab of Segment within Type

The FREQ Procedure

Frequency
Row Pct
Col Pct
Table of Type by Segment
Type Segment
Adventure Commuter E-Bike E-MTB E-Road Endurance Enduro Folding Hyperbike Mountain Naked Road Sport-Touring Street Supersport XC Total
BICYCLE (Pedal / e-assist)
0
0.00
0.00
0
0.00
0.00
1
8.33
100.00
1
8.33
100.00
1
8.33
100.00
1
8.33
100.00
1
8.33
100.00
1
8.33
100.00
0
0.00
0.00
2
16.67
100.00
0
0.00
0.00
3
25.00
100.00
0
0.00
0.00
0
0.00
0.00
0
0.00
0.00
1
8.33
100.00
12
 
 
MOTOR-CYCLE
4
22.22
100.00
1
5.56
100.00
0
0.00
0.00
0
0.00
0.00
0
0.00
0.00
0
0.00
0.00
0
0.00
0.00
0
0.00
0.00
2
11.11
100.00
0
0.00
0.00
3
16.67
100.00
0
0.00
0.00
1
5.56
100.00
1
5.56
100.00
6
33.33
100.00
0
0.00
0.00
18
 
 
Total
4
1
1
1
1
1
1
1
2
2
3
3
1
1
6
1
30


proc univariate data=work.best_bikes noprint;

   var HP_per_kg;

   histogram HP_per_kg / midpoints=0 to 1 by 0.05;

   inset mean std p5 p95 / position=ne;

   title "Distribution of Power‑to‑Weight Ratio";

run;

Log:

WARNING: The MIDPOINTS= list was extended to accommodate the data.

NOTE: PROCEDURE UNIVARIATE used (Total process time):

      real time           3.17 seconds

      user cpu time       0.40 seconds

      system cpu time     0.37 seconds

      memory              20491.43k

      OS Memory           39764.00k

      Timestamp           14/09/2015 12:29:24 AM

      Step Count                        20  Switch Count  0


8.PROC SQL summary

proc sql;

   create table work.type_summary as

   select Type,

          count(*)             as n_models,

          mean(Price_USD)      as avg_price format=comma10.,

          mean(HP_per_kg)      as avg_hp_wt format=6.3

   from   work.best_bikes

   group  by Type;

quit;

proc print;run;

Output:

Obs Type n_models avg_price avg_hp_wt
1 BICYCLE (Pedal / e-assist) 12 8,679 .
2 MOTOR-CYCLE 18 20,578 0.717


9.Reusable macros

%macro topN(metric=Price_USD, N=5);

   %let metric=%upcase(&metric);

   title "Top &N Bikes by &metric";

   proc sql outobs=&N;

      select BikeID, Brand, Model, &metric format=comma10.

      from   work.best_bikes

      order  by &metric desc;

   quit;

%mend;


%topN(metric=Rating, N=7);

Output:

Top 7 Bikes by RATING

BikeID Brand Model Rating
4 Kawasaki Ninja H2R 10
3 Ducati Panigale V4 S 10
1 Honda CBR1000RR-R Fireblade SP 10
12 Specialized S-Works Tarmac SL8 10
23 Aprilia RSV4 Factory 9
13 Trek Madone SLR 9 9
2 Yamaha YZF-R1M 9


%macro add_inr(rate=83);

   data work.best_bikes_inr;

      set work.best_bikes;

      Price_INR = round(Price_USD * &rate, 0.01);

      format Price_INR comma12.;

   run;

  proc print;run;

%mend;


%add_inr(rate=83.04);

Output:

Obs Brand Model Segment Country_Origin Type BikeID Engine_CC Power_HP Torque_Nm Weight_kg Top_Speed_kmh Price_USD Rating Year_Released Units_Sold_2024 HP_per_kg Model_Age Price_INR
1 Honda CBR1000RR-R Fireblade SP Supersport Japan MOTOR-CYCLE 1 D: =1000 cc 214 113 201.0 322 28,000 9.5 2024 3500 1.065 -9 2,325,120
2 Yamaha YZF-R1M Supersport Japan MOTOR-CYCLE 2 C: 600-999 cc 200 112 200.0 299 26,000 9.4 2023 4200 1.000 -8 2,159,040
3 Ducati Panigale V4 S Supersport Italy MOTOR-CYCLE 3 D: =1000 cc 214 124 198.0 306 32,000 9.6 2024 3700 1.081 -9 2,657,280
4 Kawasaki Ninja H2R Hyperbike Japan MOTOR-CYCLE 4 C: 600-999 cc 310 165 216.0 400 55,000 9.7 2022 800 1.435 -7 4,567,200
5 BMW S1000RR Supersport Germany MOTOR-CYCLE 5 C: 600-999 cc 205 113 197.0 299 25,000 9.3 2024 4100 1.041 -9 2,076,000
6 KTM 1290 Super Duke R Naked Austria MOTOR-CYCLE 6 D: =1000 cc 180 140 189.0 289 19,000 9.2 2023 2900 0.952 -8 1,577,760
7 Triumph Street Triple 765 RS Naked UK MOTOR-CYCLE 7 C: 600-999 cc 128 80 166.0 241 15,000 9.0 2023 3300 0.771 -8 1,245,600
8 Harley-Davidson Pan America 1250 Adventure USA MOTOR-CYCLE 8 D: =1000 cc 150 128 239.0 225 18,000 8.8 2024 2500 0.628 -9 1,494,720
9 Royal Enfield Himalayan 450 Adventure India MOTOR-CYCLE 9 B: 200-599 cc 40 45 199.0 143 6,500 8.4 2024 50000 0.201 -9 539,760
10 Bajaj Pulsar N250 Street India MOTOR-CYCLE 10 B: 200-599 cc 25 21 162.0 132 2,300 8.2 2023 120000 0.154 -8 190,992
11 Giant TCR Advanced SL 0 Disk Road Taiwan BICYCLE (Pedal / e-assist) 11 A: <200 cc 0 0 6.7 . 11,200 9.1 2024 1500 . -9 930,048
12 Specialized S-Works Tarmac SL8 Road USA BICYCLE (Pedal / e-assist) 12 A: <200 cc 0 0 6.6 . 14,500 9.5 2024 2000 . -9 1,204,080
13 Trek Madone SLR 9 Road USA BICYCLE (Pedal / e-assist) 13 A: <200 cc 0 0 7.1 . 13,000 9.4 2024 1800 . -9 1,079,520
14 Cervélo Caledonia-5 Endurance Canada BICYCLE (Pedal / e-assist) 14 A: <200 cc 0 0 7.8 . 10,500 9.0 2023 1600 . -8 871,920
15 Santa Cruz V10 Mountain USA BICYCLE (Pedal / e-assist) 15 A: <200 cc 0 0 15.3 . 10,500 8.9 2022 1000 . -7 871,920
16 Canyon Spectral Mullet Mountain Germany BICYCLE (Pedal / e-assist) 16 A: <200 cc 0 0 14.2 . 6,400 8.8 2023 2100 . -8 531,456
17 Scott Spark RC SL XC Switzerland BICYCLE (Pedal / e-assist) 17 A: <200 cc 0 0 10.2 . 12,000 9.2 2024 900 . -9 996,480
18 Yeti SB160 Enduro USA BICYCLE (Pedal / e-assist) 18 A: <200 cc 0 0 14.7 . 9,500 8.7 2024 800 . -9 788,880
19 Orbea Gain M20i E-Road Spain BICYCLE (Pedal / e-assist) 19 A: <200 cc 0 0 11.3 . 6,300 8.6 2023 1000 . -8 523,152
20 Specialized Turbo Levo SL Comp E-MTB USA BICYCLE (Pedal / e-assist) 20 A: <200 cc 0 0 17.9 . 7,500 8.9 2024 1200 . -9 622,800
21 Bajaj Dominar 400 Sport-Touring India MOTOR-CYCLE 21 B: 200-599 cc 40 35 182.0 156 3,000 8.3 2024 45000 0.220 -9 249,120
22 Suzuki Hayabusa Hyperbike Japan MOTOR-CYCLE 22 D: =1000 cc 190 150 264.0 299 28,000 9.0 2023 6000 0.720 -8 2,325,120
23 Aprilia RSV4 Factory Supersport Italy MOTOR-CYCLE 23 D: =1000 cc 217 125 199.0 305 34,000 9.4 2024 2000 1.090 -9 2,823,360
24 MV Agusta Brutale 1000 RR Naked Italy MOTOR-CYCLE 24 C: 600-999 cc 208 117 186.0 299 35,000 9.3 2023 900 1.118 -8 2,906,400
25 Hero Splendor Plus Commuter India MOTOR-CYCLE 25 A: <200 cc 8 8 112.0 96 1,000 7.8 2024 280000 0.071 -9 83,040
26 KTM RC 390 Supersport Austria MOTOR-CYCLE 26 B: 200-599 cc 44 37 172.0 178 5,100 8.5 2024 22000 0.256 -9 423,504
27 Lectric XP 3.0 E-Bike USA BICYCLE (Pedal / e-assist) 27 A: <200 cc 0 0 23.6 . 999 8.0 2024 35000 . -9 82,957
28 Brompton C Line Explore Folding UK BICYCLE (Pedal / e-assist) 28 A: <200 cc 0 0 11.6 . 1,750 8.2 2023 12000 . -8 145,320
29 BMW R1300GS Adventure Germany MOTOR-CYCLE 29 D: =1000 cc 145 143 239.0 225 20,500 9.1 2025 1000 0.607 -10 1,702,320
30 Ducati DesertX Adventure Italy MOTOR-CYCLE 30 C: 600-999 cc 110 92 223.0 242 17,000 8.9 2024 1900 0.493 -9 1,411,680


proc print data=work.best_bikes_inr (obs=5);

   var Brand Model Price_USD Price_INR;

   title "USD To INR Check (First 5 Rows)";

run;

Output:

USD To INR Check (First 5 Rows)

Obs Brand Model Price_USD Price_INR
1 Honda CBR1000RR-R Fireblade SP 28,000 2,325,120
2 Yamaha YZF-R1M 26,000 2,159,040
3 Ducati Panigale V4 S 32,000 2,657,280
4 Kawasaki Ninja H2R 55,000 4,567,200
5 BMW S1000RR 25,000 2,076,000


10.Professional‑grade reporting

proc report data=work.type_summary nowd

            headline headskip style(column)=[cellwidth=2in];

   column Type n_models avg_price avg_hp_wt;

   define Type       / group 'Bike Type';

   define n_models   / analysis 'Models';

   define avg_price  / analysis 'Average Price (USD)' format=comma10.;

   define avg_hp_wt  / analysis 'Avg HP per kg';

   title "Executive Summary — Price & Performance by Type";

run;

Output:

Executive Summary — Price & Performance by Type

Bike Type Models Average Price (USD) Avg HP per kg
BICYCLE (Pedal / e-assist) 12 8,679 .
MOTOR-CYCLE 18 20,578 0.717


proc tabulate data=work.best_bikes format=comma10.;

   class Type Segment;

   var   Price_USD;

   table Type*Segment,

         Price_USD*(n mean median p90);

   title "Price Distribution Matrix";

run;

Output:

Price Distribution Matrix

  Price_USD
N Mean Median P90
Type Segment 1 999 999 999
BICYCLE (Pedal / e-assist) E-Bike
E-MTB 1 7,500 7,500 7,500
E-Road 1 6,300 6,300 6,300
Endurance 1 10,500 10,500 10,500
Enduro 1 9,500 9,500 9,500
Folding 1 1,750 1,750 1,750
Mountain 2 8,450 8,450 10,500
Road 3 12,900 13,000 14,500
XC 1 12,000 12,000 12,000
MOTOR-CYCLE Adventure 4 15,500 17,500 20,500
Commuter 1 1,000 1,000 1,000
Hyperbike 2 41,500 41,500 55,000
Naked 3 23,000 19,000 35,000
Sport-Touring 1 3,000 3,000 3,000
Street 1 2,300 2,300 2,300
Supersport 6 25,017 27,000 34,000


11.Visualising relationships

proc sgplot data=work.best_bikes;

   scatter x=Engine_CC y=Power_HP / group=Type;

   reg     x=Engine_CC y=Power_HP / nomarkers;

   where Engine_CC>0;  /* exclude bicycles */

   title "Engine Size vs Horse‑Power (Motorcycles)";

run;

Log:
NOTE: PROCEDURE SGPLOT used (Total process time):
      real time           1.03 seconds
      user cpu time       0.06 seconds
      system cpu time     0.01 seconds
      memory              1802.78k
      OS Memory           40064.00k
      Timestamp           14/09/2015 12:36:05 AM
      Step Count                        31  Switch Count  0

NOTE: Listing image output written to SGPlot1.png.
NOTE: There were 18 observations read from the data set WORK.BEST_BIKES.
      WHERE Engine_CC>0;




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

Popular posts from this blog

409.Can We Build a Reliable Emergency Services Analytics & Fraud Detection System in SAS While Identifying and Fixing Intentional Errors?

397.If a satellite has excellent signal strength but very high latency, can it still deliver good quality communication? Why or why not?A Sas Study

401.How Efficient Are Global Data Centers? A Complete SAS Analytics Study