338.TRANSPORTATION SYSTEMS PERFORMANCE ANALYSIS USING DATA STEP | PROC SQL | PROC MEANS | PROC SGPLOT | PROC CORR | MACROS | DATE FUNCTIONS (INTCK | INTNX)

TRANSPORTATION SYSTEMS PERFORMANCE ANALYSIS USING DATA STEP | PROC SQL | PROC MEANS | PROC SGPLOT | PROC CORR | MACROS | DATE FUNCTIONS (INTCK | INTNX)

options nocenter;

1.CREATE THE DATASET OF TRANSPORT_SYSTEMS

data transport_systems;

    infile datalines dlm=',' truncover;

    input Transport_Type :$20. Country :$20. Speed Capacity Energy_Consumption Cost

          Safety_Index Start_Date :date9.;

    format Start_Date date9.;

datalines;

Metro,India,80,1500,45,200,85,01JAN2010

Tram,Germany,60,300,25,150,90,01JAN2005

Hyperloop,USA,1000,50,120,5000,95,01JAN2025

Monorail,Japan,90,800,40,400,92,01JAN2012

Bullet_Train,France,320,900,60,1500,93,01JAN2008

Maglev,China,430,1000,70,2500,97,01JAN2016

Cable_Car,Switzerland,25,20,15,80,98,01JAN2000

Ferry,Norway,40,200,100,300,88,01JAN1995

Electric_Bus,UK,55,100,20,120,89,01JAN2018

Aerial_Tram,Austria,22,25,18,75,94,01JAN2003

Suspended_Monorail,Brazil,70,600,35,220,87,01JAN2014

High_Speed_Rail,Spain,300,1100,58,1400,96,01JAN2011

;

run;

proc print data=transport_systems;

run;

OUTPUT:

ObsTransport_TypeCountrySpeedCapacityEnergy_ConsumptionCostSafety_IndexStart_Date
1MetroIndia801500452008501JAN2010
2TramGermany60300251509001JAN2005
3HyperloopUSA10005012050009501JAN2025
4MonorailJapan90800404009201JAN2012
5Bullet_TrainFrance3209006015009301JAN2008
6MaglevChina43010007025009701JAN2016
7Cable_CarSwitzerland252015809801JAN2000
8FerryNorway402001003008801JAN1995
9Electric_BusUK55100201208901JAN2018
10Aerial_TramAustria222518759401JAN2003
11Suspended_MonorailBrazil70600352208701JAN2014
12High_Speed_RailSpain30011005814009601JAN2011


2.MACRO FOR RATING CLASSIFICATION

%macro classify(var=, out=);

    if &var >= 95 then &out = "Excellent";

    else if &var >= 90 then &out = "Very_Good";

    else if &var >= 85 then &out = "Good";

    else if &var >= 80 then &out = "Moderate";

    else &out = "Poor";

%mend classify;


data transport_with_rating;

    set transport_systems;

    %classify(var=Safety_Index, out=Rating);

run;

proc print data=transport_with_rating;

run;

OUTPUT:

ObsTransport_TypeCountrySpeedCapacityEnergy_ConsumptionCostSafety_IndexStart_DateRating
1MetroIndia801500452008501JAN2010Good
2TramGermany60300251509001JAN2005Very_Good
3HyperloopUSA10005012050009501JAN2025Excellent
4MonorailJapan90800404009201JAN2012Very_Good
5Bullet_TrainFrance3209006015009301JAN2008Very_Good
6MaglevChina43010007025009701JAN2016Excellent
7Cable_CarSwitzerland252015809801JAN2000Excellent
8FerryNorway402001003008801JAN1995Good
9Electric_BusUK55100201208901JAN2018Good
10Aerial_TramAustria222518759401JAN2003Very_Good
11Suspended_MonorailBrazil70600352208701JAN2014Good
12High_Speed_RailSpain30011005814009601JAN2011Excellent


3.USE PROC SQL TO ADD DATE-BASED DERIVATIONS

proc sql;

    create table transport_enhanced as

    select *,

           intck('year', Start_Date, today()) as Years_Operational,

           intnx('year', Start_Date, 5) as Five_Year_Mark format=date9.

    from transport_with_rating;

quit;

proc print data=transport_enhanced;

run;

OUTPUT:

ObsTransport_TypeCountrySpeedCapacityEnergy_ConsumptionCostSafety_IndexStart_DateRatingYears_OperationalFive_Year_Mark
1MetroIndia801500452008501JAN2010Good1501JAN2015
2TramGermany60300251509001JAN2005Very_Good2001JAN2010
3HyperloopUSA10005012050009501JAN2025Excellent001JAN2030
4MonorailJapan90800404009201JAN2012Very_Good1301JAN2017
5Bullet_TrainFrance3209006015009301JAN2008Very_Good1701JAN2013
6MaglevChina43010007025009701JAN2016Excellent901JAN2021
7Cable_CarSwitzerland252015809801JAN2000Excellent2501JAN2005
8FerryNorway402001003008801JAN1995Good3001JAN2000
9Electric_BusUK55100201208901JAN2018Good701JAN2023
10Aerial_TramAustria222518759401JAN2003Very_Good2201JAN2008
11Suspended_MonorailBrazil70600352208701JAN2014Good1101JAN2019
12High_Speed_RailSpain30011005814009601JAN2011Excellent1401JAN2016


4.ADDITIONAL DATE METRICS (INTERVAL TREND ANALYTICS)

data transport_enhanced;

    set transport_enhanced;

    Days_Operational = intck('day', Start_Date, today());

    Quarter_Mark = intnx('qtr', Start_Date, 1);

    format Quarter_Mark date9.;

run;

proc print data=transport_enhanced;

run;

OUTPUT:

ObsTransport_TypeCountrySpeedCapacityEnergy_ConsumptionCostSafety_IndexStart_DateRatingYears_OperationalFive_Year_MarkDays_OperationalQuarter_Mark
1MetroIndia801500452008501JAN2010Good1501JAN2015582601APR2010
2TramGermany60300251509001JAN2005Very_Good2001JAN2010765201APR2005
3HyperloopUSA10005012050009501JAN2025Excellent001JAN203034701APR2025
4MonorailJapan90800404009201JAN2012Very_Good1301JAN2017509601APR2012
5Bullet_TrainFrance3209006015009301JAN2008Very_Good1701JAN2013655701APR2008
6MaglevChina43010007025009701JAN2016Excellent901JAN2021363501APR2016
7Cable_CarSwitzerland252015809801JAN2000Excellent2501JAN2005947901APR2000
8FerryNorway402001003008801JAN1995Good3001JAN20001130501APR1995
9Electric_BusUK55100201208901JAN2018Good701JAN2023290401APR2018
10Aerial_TramAustria222518759401JAN2003Very_Good2201JAN2008838301APR2003
11Suspended_MonorailBrazil70600352208701JAN2014Good1101JAN2019436501APR2014
12High_Speed_RailSpain30011005814009601JAN2011Excellent1401JAN2016546101APR2011


5.CREATING NEW VARIABLE

data logic_speed;

    set transport_enhanced;

    Speed_Growth = Years_Operational / Speed;  

run;

run;

proc print data=logic_speed;

run;

OUTPUT:

ObsTransport_TypeCountrySpeedCapacityEnergy_ConsumptionCostSafety_IndexStart_DateRatingYears_OperationalFive_Year_MarkDays_OperationalQuarter_MarkSpeed_Growth
1MetroIndia801500452008501JAN2010Good1501JAN2015582601APR20100.18750
2TramGermany60300251509001JAN2005Very_Good2001JAN2010765201APR20050.33333
3HyperloopUSA10005012050009501JAN2025Excellent001JAN203034701APR20250.00000
4MonorailJapan90800404009201JAN2012Very_Good1301JAN2017509601APR20120.14444
5Bullet_TrainFrance3209006015009301JAN2008Very_Good1701JAN2013655701APR20080.05313
6MaglevChina43010007025009701JAN2016Excellent901JAN2021363501APR20160.02093
7Cable_CarSwitzerland252015809801JAN2000Excellent2501JAN2005947901APR20001.00000
8FerryNorway402001003008801JAN1995Good3001JAN20001130501APR19950.75000
9Electric_BusUK55100201208901JAN2018Good701JAN2023290401APR20180.12727
10Aerial_TramAustria222518759401JAN2003Very_Good2201JAN2008838301APR20031.00000
11Suspended_MonorailBrazil70600352208701JAN2014Good1101JAN2019436501APR20140.15714
12High_Speed_RailSpain30011005814009601JAN2011Excellent1401JAN2016546101APR20110.04667


/* Note: In practice above there is an Invalid in this code Find it,Correct it and Use it /*

6.PROC MEANS FOR SUMMARY STATISTICS

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

    var Speed Capacity Energy_Consumption Cost Safety_Index Years_Operational;

run;

OUTPUT:

The MEANS Procedure

VariableMeanStd DevMinimumMaximum
Speed
Capacity
Energy_Consumption
Cost
Safety_Index
Years_Operational
207.67
549.58
50.50
995.42
92.00
15.25
284.21
503.54
33.15
1475.78
4.20
8.25
22.00
20.00
15.00
75.00
85.00
0.00
1000.00
1500.00
120.00
5000.00
98.00
30.00

7.CORRELATION ANALYSIS (PROC CORR)

proc corr data=transport_enhanced plots=matrix;

    var Speed Capacity Energy_Consumption Cost Safety_Index;

run;

OUTPUT:

The CORR Procedure

5 Variables:Speed Capacity Energy_Consumption Cost Safety_Index
Simple Statistics
VariableNMeanStd DevSumMinimumMaximum
Speed12207.66667284.21002249222.000001000
Capacity12549.58333503.53504659520.000001500
Energy_Consumption1250.5000033.14568606.0000015.00000120.00000
Cost12995.4166714761194575.000005000
Safety_Index1292.000004.19957110485.0000098.00000
Pearson Correlation Coefficients, N = 12
Prob > |r| under H0: Rho=0
 SpeedCapacityEnergy_ConsumptionCostSafety_Index
Speed
1.00000
 
-0.00318
0.9922
0.75152
0.0048
0.99552
<.0001
0.41960
0.1745
Capacity
-0.00318
0.9922
1.00000
 
0.06265
0.8466
-0.00640
0.9843
-0.19690
0.5396
Energy_Consumption
0.75152
0.0048
0.06265
0.8466
1.00000
 
0.77012
0.0034
0.08360
0.7962
Cost
0.99552
<.0001
-0.00640
0.9843
0.77012
0.0034
1.00000
 
0.45281
0.1394
Safety_Index
0.41960
0.1745
-0.19690
0.5396
0.08360
0.7962
0.45281
0.1394
1.00000
 
Scatter Plot Matrix


8.VISUALIZATION USING PROC SGPLOT

proc sgplot data=transport_enhanced;

    scatter x=Speed y=Cost / group=Transport_Type;

    title "Speed vs Cost Across Transportation Systems";

run;

OUTPUT:

The SGPlot Procedure


proc sgplot data=transport_enhanced;

    vbar Transport_Type / response=Safety_Index datalabel;

    title "Safety Index by Transport Type";

run;

OUTPUT:

The SGPlot Procedure


9.FORMATS FOR RATING GROUPING

proc format;

    value safetyfmt

        95 - high = 'Excellent'

        90 -< 95 = 'Very Good'

        85 -< 90 = 'Good'

        80 -< 85 = 'Moderate'

        low -< 80 = 'Poor';

run;

LOG:

NOTE: Format SAFETYFMT has been output.

proc print data=transport_enhanced;

    format Safety_Index safetyfmt.;

run;

OUTPUT:

ObsTransport_TypeCountrySpeedCapacityEnergy_ConsumptionCostSafety_IndexStart_DateRatingYears_OperationalFive_Year_MarkDays_OperationalQuarter_Mark
1MetroIndia80150045200Good01JAN2010Good1501JAN2015582601APR2010
2TramGermany6030025150Very Good01JAN2005Very_Good2001JAN2010765201APR2005
3HyperloopUSA1000501205000Excellent01JAN2025Excellent001JAN203034701APR2025
4MonorailJapan9080040400Very Good01JAN2012Very_Good1301JAN2017509601APR2012
5Bullet_TrainFrance320900601500Very Good01JAN2008Very_Good1701JAN2013655701APR2008
6MaglevChina4301000702500Excellent01JAN2016Excellent901JAN2021363501APR2016
7Cable_CarSwitzerland25201580Excellent01JAN2000Excellent2501JAN2005947901APR2000
8FerryNorway40200100300Good01JAN1995Good3001JAN20001130501APR1995
9Electric_BusUK5510020120Good01JAN2018Good701JAN2023290401APR2018
10Aerial_TramAustria22251875Very Good01JAN2003Very_Good2201JAN2008838301APR2003
11Suspended_MonorailBrazil7060035220Good01JAN2014Good1101JAN2019436501APR2014
12High_Speed_RailSpain3001100581400Excellent01JAN2011Excellent1401JAN2016546101APR2011


10.PROC SQL FOR COST PER CAPACITY ANALYSIS

proc sql;

    create table cost_efficiency as

    select Transport_Type, Country, Cost, Capacity,

           (Cost / Capacity) as Cost_Per_Seat

    from transport_enhanced;

quit;

proc print data=cost_efficiency;

run;

OUTPUT:

ObsTransport_TypeCountryCostCapacityCost_Per_Seat
1MetroIndia20015000.133
2TramGermany1503000.500
3HyperloopUSA500050100.000
4MonorailJapan4008000.500
5Bullet_TrainFrance15009001.667
6MaglevChina250010002.500
7Cable_CarSwitzerland80204.000
8FerryNorway3002001.500
9Electric_BusUK1201001.200
10Aerial_TramAustria75253.000
11Suspended_MonorailBrazil2206000.367
12High_Speed_RailSpain140011001.273

11.ADVANCED DATE FUNCTIONS FOR PROJECT ANALYSIS

data transport_final;

    set transport_enhanced;

    Next_Upgrade = intnx('year', Start_Date, 15);

    Cycles = intck('month', Start_Date, today());

    format Next_Upgrade date9.;

run;

proc print data=transport_final;

run;

OUTPUT:

ObsTransport_TypeCountrySpeedCapacityEnergy_ConsumptionCostSafety_IndexStart_DateRatingYears_OperationalFive_Year_MarkDays_OperationalQuarter_MarkNext_UpgradeCycles
1MetroIndia801500452008501JAN2010Good1501JAN2015582601APR201001JAN2025191
2TramGermany60300251509001JAN2005Very_Good2001JAN2010765201APR200501JAN2020251
3HyperloopUSA10005012050009501JAN2025Excellent001JAN203034701APR202501JAN204011
4MonorailJapan90800404009201JAN2012Very_Good1301JAN2017509601APR201201JAN2027167
5Bullet_TrainFrance3209006015009301JAN2008Very_Good1701JAN2013655701APR200801JAN2023215
6MaglevChina43010007025009701JAN2016Excellent901JAN2021363501APR201601JAN2031119
7Cable_CarSwitzerland252015809801JAN2000Excellent2501JAN2005947901APR200001JAN2015311
8FerryNorway402001003008801JAN1995Good3001JAN20001130501APR199501JAN2010371
9Electric_BusUK55100201208901JAN2018Good701JAN2023290401APR201801JAN203395
10Aerial_TramAustria222518759401JAN2003Very_Good2201JAN2008838301APR200301JAN2018275
11Suspended_MonorailBrazil70600352208701JAN2014Good1101JAN2019436501APR201401JAN2029143
12High_Speed_RailSpain30011005814009601JAN2011Excellent1401JAN2016546101APR201101JAN2026179


YESTERDAY INVALID CODE ANSWER

10.BASIC DESCRIPTIVE STATISTICS

proc mean data=space_inventions;  

    var Year;

run;


proc means data=space_inventions;  

    var Year;

run;


PROC MEAN does not exist in SAS. The correct procedure is PROC MEANS.

OUTPUT:

The MEANS Procedure

Analysis Variable : Year
NMeanStd DevMinimumMaximum
121990.0820.15602021957.002015.00

/* Note: In practice above there is an Invalid in this code Find it,Correct it and Use it /*



To Visit My Previous Software Company Analysis Dataset:Click Here
To Visit My Previous Vote Program Dataset:Click Here
To Visit My Previous Audi Cars Performance Analysis Dataset:Click Here
To Visit My Previous Global Clothing Trends Dataset:Click Here  



Follow Us On : 


 


--- FOLLOW OUR BLOG FOR MORE INFORMATION.

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

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