371.Can SAS Predict the Next Infrastructure Crisis? Analyzing Famous Global Cities

Can SAS Predict the Next Infrastructure Crisis? Analyzing Famous Global Cities


HERE IN THIS PROJECT WE USED THESE SAS STATEMENTS --PROC SQL | PROC MEANS | PROC CORR | PROC SGPLOT | MACROS | DATE FUNCTIONS (MDY-INTCK-INTNX) | MERGE | SET | APPEND | TRANSPOSE


1. Why City Infrastructure Analytics Matters

Modern cities are not judged only by population or tourism. They are evaluated by:

  • Number of buildings (urbanization)
  • Length of roads (connectivity)
  • Public transport availability (mobility)
  • Internet speed (digital readiness)

Governments, investors, real-estate developers, and smart-city planners analyze these metrics to decide:

  • Where to invest
  • Where to expand transport
  • Which cities are technologically ready

This project simulates how such analytics is performed in SAS using structured city data.


2. Create City Infrastructure Dataset

data cities_raw;

    format Record_Date date9.;

    input City_Name $ Buildings Roads_km Public_Transport Internet_Speed 

          Record_Date :date9.;

    datalines;

NewYork 1200000 14000 9 220 01JAN2024

London 900000 9500 8 210 05JAN2024

Tokyo 1500000 18000 10 240 10JAN2024

Paris 800000 7000 7 190 12JAN2024

Dubai 600000 5000 6 250 15JAN2024

Singapore 500000 4000 9 230 20JAN2024

Sydney 700000 8000 7 200 22JAN2024

Mumbai 1300000 12000 6 160 25JAN2024

Delhi 1100000 11000 6 150 27JAN2024

Berlin 650000 6000 7 195 30JAN2024

Toronto 750000 8500 8 205 01FEB2024

Seoul 1000000 9000 9 225 03FEB2024

HongKong 600000 3500 9 235 05FEB2024

LosAngeles 900000 10000 7 210 07FEB2024

Rome 500000 4500 6 180 10FEB2024

Madrid 550000 5000 7 185 12FEB2024

run;

proc print data=cities_raw;

run;

OUTPUT:

ObsRecord_DateCity_NameBuildingsRoads_kmPublic_TransportInternet_Speed
101JAN2024NewYork1200000140009220
205JAN2024London90000095008210
310JAN2024Tokyo15000001800010240
412JAN2024Paris80000070007190
515JAN2024Dubai60000050006250
620JAN2024Singapor50000040009230
722JAN2024Sydney70000080007200
825JAN2024Mumbai1300000120006160
927JAN2024Delhi1100000110006150
1030JAN2024Berlin65000060007195
1101FEB2024Toronto75000085008205
1203FEB2024Seoul100000090009225
1305FEB2024HongKong60000035009235
1407FEB2024LosAngel900000100007210
1510FEB2024Rome50000045006180
1612FEB2024Madrid55000050007185


3. Date Engineering Using MDY, INTCK, INTNX

data cities_dates;

    set cities_raw;

    Report_Date = mdy(3,1,2024);

    Months_Since = intck('month', Record_Date, Report_Date);

    Next_Review = intnx('month', Record_Date, 3, 'same');

    format Report_Date Next_Review date9.;

run;

proc print data=cities_dates;

run;

OUTPUT:

ObsRecord_DateCity_NameBuildingsRoads_kmPublic_TransportInternet_SpeedReport_DateMonths_SinceNext_Review
101JAN2024NewYork120000014000922001MAR2024201APR2024
205JAN2024London9000009500821001MAR2024205APR2024
310JAN2024Tokyo1500000180001024001MAR2024210APR2024
412JAN2024Paris8000007000719001MAR2024212APR2024
515JAN2024Dubai6000005000625001MAR2024215APR2024
620JAN2024Singapor5000004000923001MAR2024220APR2024
722JAN2024Sydney7000008000720001MAR2024222APR2024
825JAN2024Mumbai130000012000616001MAR2024225APR2024
927JAN2024Delhi110000011000615001MAR2024227APR2024
1030JAN2024Berlin6500006000719501MAR2024230APR2024
1101FEB2024Toronto7500008500820501MAR2024101MAY2024
1203FEB2024Seoul10000009000922501MAR2024103MAY2024
1305FEB2024HongKong6000003500923501MAR2024105MAY2024
1407FEB2024LosAngel90000010000721001MAR2024107MAY2024
1510FEB2024Rome5000004500618001MAR2024110MAY2024
1612FEB2024Madrid5500005000718501MAR2024112MAY2024

Business meaning:

·       Report_Date → Corporate reporting date

·       Months_Since → How old the data is

·       Next_Review → When city data will be reviewed again


4. Infrastructure Score Macro

%macro infra_score;

data cities_score;

    set cities_dates;

    Infrastructure_Score = (Buildings/100000) + (Roads_km/1000) + (Public_Transport*5)

                           +  (Internet_Speed/10);

run;

proc print data=cities_score;

run;

%mend;


%infra_score;

OUTPUT:

ObsRecord_DateCity_NameBuildingsRoads_kmPublic_TransportInternet_SpeedReport_DateMonths_SinceNext_ReviewInfrastructure_Score
101JAN2024NewYork120000014000922001MAR2024201APR202493.0
205JAN2024London9000009500821001MAR2024205APR202479.5
310JAN2024Tokyo1500000180001024001MAR2024210APR2024107.0
412JAN2024Paris8000007000719001MAR2024212APR202469.0
515JAN2024Dubai6000005000625001MAR2024215APR202466.0
620JAN2024Singapor5000004000923001MAR2024220APR202477.0
722JAN2024Sydney7000008000720001MAR2024222APR202470.0
825JAN2024Mumbai130000012000616001MAR2024225APR202471.0
927JAN2024Delhi110000011000615001MAR2024227APR202467.0
1030JAN2024Berlin6500006000719501MAR2024230APR202467.0
1101FEB2024Toronto7500008500820501MAR2024101MAY202476.5
1203FEB2024Seoul10000009000922501MAR2024103MAY202486.5
1305FEB2024HongKong6000003500923501MAR2024105MAY202478.0
1407FEB2024LosAngel90000010000721001MAR2024107MAY202475.0
1510FEB2024Rome5000004500618001MAR2024110MAY202457.5
1612FEB2024Madrid5500005000718501MAR2024112MAY202464.0

This macro converts different units into a single infrastructure index.


5. PROC SQL – Business Intelligence Queries

proc sql;

    create table city_ranking as

    select City_Name, Infrastructure_Score,

           case 

              when Infrastructure_Score >= 120 then "WORLD CLASS"

              when Infrastructure_Score >= 90 then "ADVANCED"

              else "DEVELOPING"

           end as City_Class

    from cities_score

    order by Infrastructure_Score desc;

quit;

proc print data=city_ranking;

run;

OUTPUT:

ObsCity_NameInfrastructure_ScoreCity_Class
1Tokyo107.0ADVANCED
2NewYork93.0ADVANCED
3Seoul86.5DEVELOPING
4London79.5DEVELOPING
5HongKong78.0DEVELOPING
6Singapor77.0DEVELOPING
7Toronto76.5DEVELOPING
8LosAngel75.0DEVELOPING
9Mumbai71.0DEVELOPING
10Sydney70.0DEVELOPING
11Paris69.0DEVELOPING
12Berlin67.0DEVELOPING
13Delhi67.0DEVELOPING
14Dubai66.0DEVELOPING
15Madrid64.0DEVELOPING
16Rome57.5DEVELOPING


6. PROC MEANS – Infrastructure Statistics

proc means data=cities_score mean min max;

    var Buildings Roads_km Public_Transport Internet_Speed Infrastructure_Score;

run;

OUTPUT:

The MEANS Procedure

VariableMeanMinimumMaximum
Buildings
Roads_km
Public_Transport
Internet_Speed
Infrastructure_Score
846875.00
8437.50
7.5625000
205.3125000
75.2500000
500000.00
3500.00
6.0000000
150.0000000
57.5000000
1500000.00
18000.00
10.0000000
250.0000000
107.0000000

This gives:

·       Average buildings per city

·       Average internet speed

·       Overall infrastructure quality


7. PROC CORR – Technology vs Infrastructure

proc corr data=cities_score;

    var Buildings Roads_km Public_Transport Internet_Speed Infrastructure_Score;

run;

OUTPUT:

The CORR Procedure

5 Variables:Buildings Roads_km Public_Transport Internet_Speed Infrastructure_Score
Simple Statistics
VariableNMeanStd DevSumMinimumMaximum
Buildings16846875302472135500005000001500000
Roads_km1684383974135000350018000
Public_Transport167.562501.31498121.000006.0000010.00000
Internet_Speed16205.3125028.134723285150.00000250.00000
Infrastructure_Score1675.2500012.18743120457.50000107.00000
Pearson Correlation Coefficients, N = 16
Prob > |r| under H0: Rho=0
 BuildingsRoads_kmPublic_TransportInternet_SpeedInfrastructure_Score
Buildings
1.00000
 
0.95922
<.0001
0.27289
0.3065
-0.09193
0.7349
0.68699
0.0033
Roads_km
0.95922
<.0001
1.00000
 
0.31332
0.2373
-0.03410
0.9002
0.72533
0.0015
Public_Transport
0.27289
0.3065
0.31332
0.2373
1.00000
 
0.66166
0.0052
0.86213
<.0001
Internet_Speed
-0.09193
0.7349
-0.03410
0.9002
0.66166
0.0052
1.00000
 
0.55387
0.0260
Infrastructure_Score
0.68699
0.0033
0.72533
0.0015
0.86213
<.0001
0.55387
0.0260
1.00000
 

8. PROC SGPLOT – Visualization

proc sgplot data=cities_score;

    scatter x=Internet_Speed y=Infrastructure_Score;

    title "Internet Speed vs Infrastructure Score";

run;

OUTPUT:

The SGPlot Procedure

This graph shows whether digital development drives overall infrastructure.


9. APPEND – Adding New Cities

data new_cities;

    format Record_Date date9.;

    input City_Name $ Buildings Roads_km Public_Transport Internet_Speed Record_Date :date9.;

    datalines;

Bangkok 700000 6500 7 190 15FEB2024

Vienna 600000 5500 8 200 18FEB2024

;

run;

proc print data=new_cities;

run;

OUTPUT:

ObsRecord_DateCity_NameBuildingsRoads_kmPublic_TransportInternet_Speed
115FEB2024Bangkok70000065007190
218FEB2024Vienna60000055008200


proc append base=cities_raw 

            data=new_cities force;

run;

proc print data=cities_raw;

run;

OUTPUT:

ObsRecord_DateCity_NameBuildingsRoads_kmPublic_TransportInternet_Speed
101JAN2024NewYork1200000140009220
205JAN2024London90000095008210
310JAN2024Tokyo15000001800010240
412JAN2024Paris80000070007190
515JAN2024Dubai60000050006250
620JAN2024Singapor50000040009230
722JAN2024Sydney70000080007200
825JAN2024Mumbai1300000120006160
927JAN2024Delhi1100000110006150
1030JAN2024Berlin65000060007195
1101FEB2024Toronto75000085008205
1203FEB2024Seoul100000090009225
1305FEB2024HongKong60000035009235
1407FEB2024LosAngel900000100007210
1510FEB2024Rome50000045006180
1612FEB2024Madrid55000050007185
1715FEB2024Bangkok70000065007190
1818FEB2024Vienna60000055008200

This simulates new cities joining a smart-city program.


10. SET – Combine Old and New

data all_cities;

    set cities_raw 

        new_cities;

run;

proc print data=all_cities;

run;

OUTPUT:

ObsRecord_DateCity_NameBuildingsRoads_kmPublic_TransportInternet_Speed
101JAN2024NewYork1200000140009220
205JAN2024London90000095008210
310JAN2024Tokyo15000001800010240
412JAN2024Paris80000070007190
515JAN2024Dubai60000050006250
620JAN2024Singapor50000040009230
722JAN2024Sydney70000080007200
825JAN2024Mumbai1300000120006160
927JAN2024Delhi1100000110006150
1030JAN2024Berlin65000060007195
1101FEB2024Toronto75000085008205
1203FEB2024Seoul100000090009225
1305FEB2024HongKong60000035009235
1407FEB2024LosAngel900000100007210
1510FEB2024Rome50000045006180
1612FEB2024Madrid55000050007185
1715FEB2024Bangkok70000065007190
1818FEB2024Vienna60000055008200
1915FEB2024Bangkok70000065007190
2018FEB2024Vienna60000055008200


11. MERGE – Add Country Information

data country_map;

    input City_Name $ Country $;

    datalines;

NewYork USA

London UK

Tokyo Japan

Paris France

Dubai UAE

Singapore Singapore

Sydney Australia

Mumbai India

Delhi India

Berlin Germany

Toronto Canada

Seoul SouthKorea

HongKong China

LosAngeles USA

Rome Italy

Madrid Spain

Bangkok Thailand

Vienna Austria

;

run;

proc print data=country_map;

run;

OUTPUT:

ObsCity_NameCountry
1NewYorkUSA
2LondonUK
3TokyoJapan
4ParisFrance
5DubaiUAE
6SingaporSingapor
7SydneyAustrali
8MumbaiIndia
9DelhiIndia
10BerlinGermany
11TorontoCanada
12SeoulSouthKor
13HongKongChina
14LosAngelUSA
15RomeItaly
16MadridSpain
17BangkokThailand
18ViennaAustria


proc sort data=all_cities; by City_Name; run;

proc print data=all_cities;

run;

OUTPUT:

ObsRecord_DateCity_NameBuildingsRoads_kmPublic_TransportInternet_Speed
115FEB2024Bangkok70000065007190
215FEB2024Bangkok70000065007190
330JAN2024Berlin65000060007195
427JAN2024Delhi1100000110006150
515JAN2024Dubai60000050006250
605FEB2024HongKong60000035009235
705JAN2024London90000095008210
807FEB2024LosAngel900000100007210
912FEB2024Madrid55000050007185
1025JAN2024Mumbai1300000120006160
1101JAN2024NewYork1200000140009220
1212JAN2024Paris80000070007190
1310FEB2024Rome50000045006180
1403FEB2024Seoul100000090009225
1520JAN2024Singapor50000040009230
1622JAN2024Sydney70000080007200
1710JAN2024Tokyo15000001800010240
1801FEB2024Toronto75000085008205
1918FEB2024Vienna60000055008200
2018FEB2024Vienna60000055008200


proc sort data=country_map; by City_Name; run;

proc print data=country_map;

run;

OUTPUT:

ObsCity_NameCountry
1BangkokThailand
2BerlinGermany
3DelhiIndia
4DubaiUAE
5HongKongChina
6LondonUK
7LosAngelUSA
8MadridSpain
9MumbaiIndia
10NewYorkUSA
11ParisFrance
12RomeItaly
13SeoulSouthKor
14SingaporSingapor
15SydneyAustrali
16TokyoJapan
17TorontoCanada
18ViennaAustria


data city_full;

    merge all_cities country_map;

    by City_Name;

run;

proc print data=city_full;

run;

OUTPUT:

ObsRecord_DateCity_NameBuildingsRoads_kmPublic_TransportInternet_SpeedCountry
115FEB2024Bangkok70000065007190Thailand
215FEB2024Bangkok70000065007190Thailand
330JAN2024Berlin65000060007195Germany
427JAN2024Delhi1100000110006150India
515JAN2024Dubai60000050006250UAE
605FEB2024HongKong60000035009235China
705JAN2024London90000095008210UK
807FEB2024LosAngel900000100007210USA
912FEB2024Madrid55000050007185Spain
1025JAN2024Mumbai1300000120006160India
1101JAN2024NewYork1200000140009220USA
1212JAN2024Paris80000070007190France
1310FEB2024Rome50000045006180Italy
1403FEB2024Seoul100000090009225SouthKor
1520JAN2024Singapor50000040009230Singapor
1622JAN2024Sydney70000080007200Australi
1710JAN2024Tokyo15000001800010240Japan
1801FEB2024Toronto75000085008205Canada
1918FEB2024Vienna60000055008200Austria
2018FEB2024Vienna60000055008200Austria


12. TRANSPOSE – Infrastructure Report Format

proc transpose data=city_ranking out=city_transpose;

    id City_Name NotSorted;

    var Infrastructure_Score;

run;

proc print data=city_transpose;

run;

OUTPUT:

Obs_NAME_TokyoNewYorkSeoulLondonHongKongSingaporTorontoLosAngelMumbaiSydneyParisBerlinDelhiDubaiMadridRome
1Infrastructure_Score1079386.579.5787776.5757170696767666457.5

This produces a horizontal city-wise infrastructure dashboard.


13. How This Mimics Real-World Urban Analytics

In real governments:

·       Buildings = urban density

·       Roads_km = transportation capacity

·       Public_Transport = mobility index

·       Internet_Speed = digital readiness

Smart-city departments compute a single composite score exactly like our macro.

Cities are then classified into:

·       Developing

·       Advanced

·       World Class

Funding and development are allocated based on this.


14. What We Learned Technically

This project teaches you:

SAS Skill

Business Meaning

DATA step

Data ingestion

MDY, INTCK, INTNX

Time-based infrastructure reviews

PROC SQL

City classification

PROC MEANS

Infrastructure averages

PROC CORR

Relationship analysis

PROC SGPLOT

City performance visualization

Macros

Automation

APPEND

Add new cities

SET

Combine datasets

MERGE

Geographic mapping

TRANSPOSE

Dashboard format


15. Why This Project Is Interview-Ready

This project mirrors:

·       Government urban development analysis

·       Smart city funding evaluation

·       Infrastructure benchmarking

·       Technology readiness assessment

If you can explain this in an interview, you demonstrate:

·       SAS programming

·       Data modeling

·       Analytics logic

·       Business thinking

16. Conclusion

We have now built a complete Smart City Infrastructure Analytics System using SAS.

This is not just coding — it is decision-making analytics similar to what urban planners, governments, and technology investors use globally.


About the Author:

SAS Learning Hub is a data analytics and SAS programming platform focused on clinical, financial, and real-world data analysis. The content is created by professionals with academic training in Pharmaceutics and hands-on experience in Base SAS, PROC SQL, Macros, SDTM, and ADaM, providing practical and industry-relevant SAS learning resources.


Disclaimer:

The datasets and analysis in this article are created for educational and demonstration purposes only. They do not represent real Infrastructure data.


Our Mission:

This blog provides industry-focused SAS programming tutorials and analytics projects covering finance, healthcare, and technology.


This project is suitable for:

SAS Programmer Interviews

SAS Programmer Job Seekers

SAS Analysts


Follow Us On : 


 


--->Follow our blog for more SAS-based analytics projects and industry data models.


To deepen your understanding of SAS analytics, please refer to our other data science and industry-focused projects listed below:









 

Comments

Popular posts from this blog

412.Can We Build And Clean A University Course Analytics & Fraud Detection System In Sas Using Only Macros While Intentionally Creating And Fixing Errors?

416.Can We Design, Debug, Detect Fraud, and Build an ADaM-Ready Autonomous Drone Flight Analytics System Using Advanced SAS Programming Techniques?

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