375.What Happens When You Analyze Earthquakes with SAS?

What Happens When You Analyze Earthquakes with SAS?


HERE IN THIS PROJECT WE USED THESE SAS STATEMENTS ---DATA STEP | PROC SQL | MACROS | SGPLOT | DATE FUNCTIONS (MDY-INTCK-INTNX) |  FUNCTIONS (UPCASE-LOWCASE-PROPCASE-SUBSTR) | APPEND | MERGE | SET | TRANSPOSE | PROC UNIVARIATE | PROC COPY | PROC DELETE

1. Project Overview

Earthquakes are among the most destructive natural disasters. Accurate data preparation, transformation, and analysis are critical for risk assessment, disaster management, and early warning systems.

This project simulates a global earthquake monitoring system, where seismic events are recorded, processed, classified, and analyzed using Base SAS and Advanced SAS techniques.

Here We Learn:

·       How to design a structured dataset

·       How to clean and standardize textual data

·       How to work with dates using MDY, INTNX, INTCK

·       How to apply DATA step, PROC SQL, and statistical procedures

·       How to build reusable SAS macros

·       How to reshape data using TRANSPOSE

·       How to combine datasets using SET, MERGE, APPEND

·       How to classify seismic risk programmatically

·       How to visualize seismic trends

·       How to copy datasets across libraries


2. Dataset Design

Core Variables

Variable

Description

Earthquake_ID

Unique identifier

Country

Affected country

Magnitude

Richter magnitude

Depth_km

Depth below earth surface

Duration_Seconds

Duration of shaking

Damage_Level

Low / Moderate / Severe

Alert_Type

Advisory / Watch / Warning

Event_Date

Earthquake occurrence date

Report_Date

Reporting date


3. Creating the Earthquake Dataset (DATA Step)

data earthquakes_raw;

    length Earthquake_ID $10 Country $20 Damage_Level $10 Alert_Type $10;

    format Event_Date Report_Date date9.;

    input Earthquake_ID $ Country $ Magnitude Depth_km Duration_Seconds Damage_Level $

          Alert_Type $ Event_Date : date9. Report_Date : date9.;

datalines;

EQ001 india 6.5 15 45 Moderate Watch 01JAN2023 02JAN2023

EQ002 japan 7.8 30 70 Severe Warning 12FEB2023 13FEB2023

EQ003 chile 6.1 10 38 Moderate Advisory 20MAR2023 21MAR2023

EQ004 nepal 5.9 12 32 Low Advisory 05APR2023 06APR2023

EQ005 indonesia 7.2 25 65 Severe Warning 15MAY2023 16MAY2023

EQ006 turkey 6.8 18 55 Severe Warning 01JUN2023 02JUN2023

EQ007 usa 5.5 8 25 Low Advisory 10JUL2023 11JUL2023

EQ008 mexico 6.3 20 48 Moderate Watch 22AUG2023 23AUG2023

EQ009 italy 5.7 10 28 Low Advisory 03SEP2023 04SEP2023

EQ010 iran 6.9 22 60 Severe Warning 14OCT2023 15OCT2023

EQ011 peru 6.4 15 42 Moderate Watch 28NOV2023 29NOV2023

EQ012 china 7.5 35 80 Severe Warning 09DEC2023 10DEC2023

EQ013 greece 5.8 12 30 Low Advisory 02JAN2024 03JAN2024

EQ014 afghanistan 6.7 28 58 Severe Warning 18FEB2024 19FEB2024

EQ015 philippines 6.2 18 40 Moderate Watch 30MAR2024 31MAR2024

EQ016 newzealand 5.9 14 33 Low Advisory 15APR2024 16APR2024

;

run;

proc print data=earthquakes_raw;

run;

OUTPUT:

ObsEarthquake_IDCountryDamage_LevelAlert_TypeEvent_DateReport_DateMagnitudeDepth_kmDuration_Seconds
1EQ001indiaModerateWatch01JAN202302JAN20236.51545
2EQ002japanSevereWarning12FEB202313FEB20237.83070
3EQ003chileModerateAdvisory20MAR202321MAR20236.11038
4EQ004nepalLowAdvisory05APR202306APR20235.91232
5EQ005indonesiaSevereWarning15MAY202316MAY20237.22565
6EQ006turkeySevereWarning01JUN202302JUN20236.81855
7EQ007usaLowAdvisory10JUL202311JUL20235.5825
8EQ008mexicoModerateWatch22AUG202323AUG20236.32048
9EQ009italyLowAdvisory03SEP202304SEP20235.71028
10EQ010iranSevereWarning14OCT202315OCT20236.92260
11EQ011peruModerateWatch28NOV202329NOV20236.41542
12EQ012chinaSevereWarning09DEC202310DEC20237.53580
13EQ013greeceLowAdvisory02JAN202403JAN20245.81230
14EQ014afghanistanSevereWarning18FEB202419FEB20246.72858
15EQ015philippinesModerateWatch30MAR202431MAR20246.21840
16EQ016newzealandLowAdvisory15APR202416APR20245.91433


4. Data Cleaning & Standardization (Functions)

data earthquakes_clean;

    set earthquakes_raw;


    Country = propcase(lowcase(trim(Country)));

    Alert_Type = upcase(compress(Alert_Type));

    Damage_Level = propcase(Damage_Level);


    Country_Code = substr(Country,1,3);

    Event_Month = intnx('month', Event_Date, 0, 'b');

    Days_To_Report = intck('day', Event_Date, Report_Date);


format Event_Month monyy7.;

    label Days_To_Report = "Days between Event and Report";

run;

proc print data=earthquakes_clean;

run;

OUTPUT:

ObsEarthquake_IDCountryDamage_LevelAlert_TypeEvent_DateReport_DateMagnitudeDepth_kmDuration_SecondsCountry_CodeEvent_MonthDays_To_Report
1EQ001IndiaModerateWATCH01JAN202302JAN20236.51545IndJAN20231
2EQ002JapanSevereWARNING12FEB202313FEB20237.83070JapFEB20231
3EQ003ChileModerateADVISORY20MAR202321MAR20236.11038ChiMAR20231
4EQ004NepalLowADVISORY05APR202306APR20235.91232NepAPR20231
5EQ005IndonesiaSevereWARNING15MAY202316MAY20237.22565IndMAY20231
6EQ006TurkeySevereWARNING01JUN202302JUN20236.81855TurJUN20231
7EQ007UsaLowADVISORY10JUL202311JUL20235.5825UsaJUL20231
8EQ008MexicoModerateWATCH22AUG202323AUG20236.32048MexAUG20231
9EQ009ItalyLowADVISORY03SEP202304SEP20235.71028ItaSEP20231
10EQ010IranSevereWARNING14OCT202315OCT20236.92260IraOCT20231
11EQ011PeruModerateWATCH28NOV202329NOV20236.41542PerNOV20231
12EQ012ChinaSevereWARNING09DEC202310DEC20237.53580ChiDEC20231
13EQ013GreeceLowADVISORY02JAN202403JAN20245.81230GreJAN20241
14EQ014AfghanistanSevereWARNING18FEB202419FEB20246.72858AfgFEB20241
15EQ015PhilippinesModerateWATCH30MAR202431MAR20246.21840PhiMAR20241
16EQ016NewzealandLowADVISORY15APR202416APR20245.91433NewAPR20241


5. Seismic Risk Classification (Macro)

%macro seismic_risk(input=, output=);

data &output;

    set &input;

    length Seismic_Risk $15;

    if Magnitude >= 7 then Seismic_Risk = "High Risk";

    else if Magnitude >= 6 then Seismic_Risk = "Moderate Risk";

    else Seismic_Risk = "Low Risk";

run;

proc print data=&output;

run;

%mend;


%seismic_risk(input=earthquakes_clean, output=earthquakes_risk);

OUTPUT:

ObsEarthquake_IDCountryDamage_LevelAlert_TypeEvent_DateReport_DateMagnitudeDepth_kmDuration_SecondsCountry_CodeEvent_MonthDays_To_ReportSeismic_Risk
1EQ001IndiaModerateWATCH01JAN202302JAN20236.51545IndJAN20231Moderate Risk
2EQ002JapanSevereWARNING12FEB202313FEB20237.83070JapFEB20231High Risk
3EQ003ChileModerateADVISORY20MAR202321MAR20236.11038ChiMAR20231Moderate Risk
4EQ004NepalLowADVISORY05APR202306APR20235.91232NepAPR20231Low Risk
5EQ005IndonesiaSevereWARNING15MAY202316MAY20237.22565IndMAY20231High Risk
6EQ006TurkeySevereWARNING01JUN202302JUN20236.81855TurJUN20231Moderate Risk
7EQ007UsaLowADVISORY10JUL202311JUL20235.5825UsaJUL20231Low Risk
8EQ008MexicoModerateWATCH22AUG202323AUG20236.32048MexAUG20231Moderate Risk
9EQ009ItalyLowADVISORY03SEP202304SEP20235.71028ItaSEP20231Low Risk
10EQ010IranSevereWARNING14OCT202315OCT20236.92260IraOCT20231Moderate Risk
11EQ011PeruModerateWATCH28NOV202329NOV20236.41542PerNOV20231Moderate Risk
12EQ012ChinaSevereWARNING09DEC202310DEC20237.53580ChiDEC20231High Risk
13EQ013GreeceLowADVISORY02JAN202403JAN20245.81230GreJAN20241Low Risk
14EQ014AfghanistanSevereWARNING18FEB202419FEB20246.72858AfgFEB20241Moderate Risk
15EQ015PhilippinesModerateWATCH30MAR202431MAR20246.21840PhiMAR20241Moderate Risk
16EQ016NewzealandLowADVISORY15APR202416APR20245.91433NewAPR20241Low Risk


6. PROC SQL Analysis

proc sql;

    create table country_summary as

    select Country,

           count(*) as Total_Events,

           avg(Magnitude) as Avg_Magnitude format=5.2,

           avg(Depth_km) as Avg_Depth format=6.2

    from earthquakes_risk

    group by Country;

quit;

proc print data=country_summary;

run;

OUTPUT:

ObsCountryTotal_EventsAvg_MagnitudeAvg_Depth
1Afghanistan16.7028.00
2Chile16.1010.00
3China17.5035.00
4Greece15.8012.00
5India16.5015.00
6Indonesia17.2025.00
7Iran16.9022.00
8Italy15.7010.00
9Japan17.8030.00
10Mexico16.3020.00
11Nepal15.9012.00
12Newzealand15.9014.00
13Peru16.4015.00
14Philippines16.2018.00
15Turkey16.8018.00
16Usa15.508.00


7. Statistical Analysis – PROC MEANS

proc means data=earthquakes_risk mean min max std;

    class Seismic_Risk;

    var Magnitude Depth_km Duration_Seconds Days_To_Report;

run;

OUTPUT:

The MEANS Procedure

Seismic_RiskN ObsVariableLabelMeanMinimumMaximumStd Dev
High Risk3
Magnitude
Depth_km
Duration_Seconds
Days_To_Report
 
 
 
Days between Event and Report
7.5000000
30.0000000
71.6666667
1.0000000
7.2000000
25.0000000
65.0000000
1.0000000
7.8000000
35.0000000
80.0000000
1.0000000
0.3000000
5.0000000
7.6376262
0
Low Risk5
Magnitude
Depth_km
Duration_Seconds
Days_To_Report
 
 
 
Days between Event and Report
5.7600000
11.2000000
29.6000000
1.0000000
5.5000000
8.0000000
25.0000000
1.0000000
5.9000000
14.0000000
33.0000000
1.0000000
0.1673320
2.2803509
3.2093613
0
Moderate Risk8
Magnitude
Depth_km
Duration_Seconds
Days_To_Report
 
 
 
Days between Event and Report
6.4875000
18.2500000
48.2500000
1.0000000
6.1000000
10.0000000
38.0000000
1.0000000
6.9000000
28.0000000
60.0000000
1.0000000
0.2900123
5.3652320
8.4642104
0

8. Distribution Analysis – PROC UNIVARIATE

proc univariate data=earthquakes_risk;

    var Magnitude;

    histogram Magnitude;

run;

OUTPUT:

The UNIVARIATE Procedure

Variable: Magnitude

Moments
N16Sum Weights16
Mean6.45Sum Observations103.2
Std Deviation0.66231916Variance0.43866667
Skewness0.58767957Kurtosis-0.3820146
Uncorrected SS672.22Corrected SS6.58
Coeff Variation10.2685141Std Error Mean0.16557979
Basic Statistical Measures
LocationVariability
Mean6.450000Std Deviation0.66232
Median6.350000Variance0.43867
Mode5.900000Range2.30000
  Interquartile Range0.95000
Tests for Location: Mu0=0
TestStatisticp Value
Student's tt38.95403Pr > |t|<.0001
SignM8Pr >= |M|<.0001
Signed RankS68Pr >= |S|<.0001
Quantiles (Definition 5)
LevelQuantile
100% Max7.80
99%7.80
95%7.80
90%7.50
75% Q36.85
50% Median6.35
25% Q15.90
10%5.70
5%5.50
1%5.50
0% Min5.50
Extreme Observations
LowestHighest
ValueObsValueObs
5.576.86
5.796.910
5.8137.25
5.9167.512
5.947.82

The UNIVARIATE Procedure

Histogram for Magnitude

9. Visualization – PROC SGPLOT

proc sgplot data=earthquakes_risk;

    scatter x=Depth_km y=Magnitude / group=Seismic_Risk;

    title "Earthquake Magnitude vs Depth by Seismic Risk";

run;

OUTPUT:

The SGPlot Procedure


10. Data Reshaping – PROC TRANSPOSE

proc transpose data=country_summary out=country_transposed;

    by Country;

    var Avg_Magnitude Avg_Depth;

run;

proc print data=country_transposed;

run;

OUTPUT:

ObsCountry_NAME_COL1
1AfghanistanAvg_Magnitude6.7
2AfghanistanAvg_Depth28.0
3ChileAvg_Magnitude6.1
4ChileAvg_Depth10.0
5ChinaAvg_Magnitude7.5
6ChinaAvg_Depth35.0
7GreeceAvg_Magnitude5.8
8GreeceAvg_Depth12.0
9IndiaAvg_Magnitude6.5
10IndiaAvg_Depth15.0
11IndonesiaAvg_Magnitude7.2
12IndonesiaAvg_Depth25.0
13IranAvg_Magnitude6.9
14IranAvg_Depth22.0
15ItalyAvg_Magnitude5.7
16ItalyAvg_Depth10.0
17JapanAvg_Magnitude7.8
18JapanAvg_Depth30.0
19MexicoAvg_Magnitude6.3
20MexicoAvg_Depth20.0
21NepalAvg_Magnitude5.9
22NepalAvg_Depth12.0
23NewzealandAvg_Magnitude5.9
24NewzealandAvg_Depth14.0
25PeruAvg_Magnitude6.4
26PeruAvg_Depth15.0
27PhilippinesAvg_Magnitude6.2
28PhilippinesAvg_Depth18.0
29TurkeyAvg_Magnitude6.8
30TurkeyAvg_Depth18.0
31UsaAvg_Magnitude5.5
32UsaAvg_Depth8.0


11.Create a new dataset

data earthquakes_new;

    set earthquakes_risk;

    where Event_Date >= '01JAN2024'd;

run;

proc print data=earthquakes_new;

run;

OUTPUT:

ObsEarthquake_IDCountryDamage_LevelAlert_TypeEvent_DateReport_DateMagnitudeDepth_kmDuration_SecondsCountry_CodeEvent_MonthDays_To_ReportSeismic_Risk
1EQ013GreeceLowADVISORY02JAN202403JAN20245.81230GreJAN20241Low Risk
2EQ014AfghanistanSevereWARNING18FEB202419FEB20246.72858AfgFEB20241Moderate Risk
3EQ015PhilippinesModerateWATCH30MAR202431MAR20246.21840PhiMAR20241Moderate Risk
4EQ016NewzealandLowADVISORY15APR202416APR20245.91433NewAPR20241Low Risk


12. Dataset Combination Techniques

SET

data combined_events;

    set earthquakes_risk 

        earthquakes_new;

run;

proc print data=country_transposed;

run;

OUTPUT:

ObsCountry_NAME_COL1
1AfghanistanAvg_Magnitude6.7
2AfghanistanAvg_Depth28.0
3ChileAvg_Magnitude6.1
4ChileAvg_Depth10.0
5ChinaAvg_Magnitude7.5
6ChinaAvg_Depth35.0
7GreeceAvg_Magnitude5.8
8GreeceAvg_Depth12.0
9IndiaAvg_Magnitude6.5
10IndiaAvg_Depth15.0
11IndonesiaAvg_Magnitude7.2
12IndonesiaAvg_Depth25.0
13IranAvg_Magnitude6.9
14IranAvg_Depth22.0
15ItalyAvg_Magnitude5.7
16ItalyAvg_Depth10.0
17JapanAvg_Magnitude7.8
18JapanAvg_Depth30.0
19MexicoAvg_Magnitude6.3
20MexicoAvg_Depth20.0
21NepalAvg_Magnitude5.9
22NepalAvg_Depth12.0
23NewzealandAvg_Magnitude5.9
24NewzealandAvg_Depth14.0
25PeruAvg_Magnitude6.4
26PeruAvg_Depth15.0
27PhilippinesAvg_Magnitude6.2
28PhilippinesAvg_Depth18.0
29TurkeyAvg_Magnitude6.8
30TurkeyAvg_Depth18.0
31UsaAvg_Magnitude5.5
32UsaAvg_Depth8.0


APPEND

proc append base=earthquakes_risk

            data=earthquakes_new;

run;

proc print data=earthquakes_risk;

run;

OUTPUT:

ObsEarthquake_IDCountryDamage_LevelAlert_TypeEvent_DateReport_DateMagnitudeDepth_kmDuration_SecondsCountry_CodeEvent_MonthDays_To_ReportSeismic_Risk
1EQ001IndiaModerateWATCH01JAN202302JAN20236.51545IndJAN20231Moderate Risk
2EQ002JapanSevereWARNING12FEB202313FEB20237.83070JapFEB20231High Risk
3EQ003ChileModerateADVISORY20MAR202321MAR20236.11038ChiMAR20231Moderate Risk
4EQ004NepalLowADVISORY05APR202306APR20235.91232NepAPR20231Low Risk
5EQ005IndonesiaSevereWARNING15MAY202316MAY20237.22565IndMAY20231High Risk
6EQ006TurkeySevereWARNING01JUN202302JUN20236.81855TurJUN20231Moderate Risk
7EQ007UsaLowADVISORY10JUL202311JUL20235.5825UsaJUL20231Low Risk
8EQ008MexicoModerateWATCH22AUG202323AUG20236.32048MexAUG20231Moderate Risk
9EQ009ItalyLowADVISORY03SEP202304SEP20235.71028ItaSEP20231Low Risk
10EQ010IranSevereWARNING14OCT202315OCT20236.92260IraOCT20231Moderate Risk
11EQ011PeruModerateWATCH28NOV202329NOV20236.41542PerNOV20231Moderate Risk
12EQ012ChinaSevereWARNING09DEC202310DEC20237.53580ChiDEC20231High Risk
13EQ013GreeceLowADVISORY02JAN202403JAN20245.81230GreJAN20241Low Risk
14EQ014AfghanistanSevereWARNING18FEB202419FEB20246.72858AfgFEB20241Moderate Risk
15EQ015PhilippinesModerateWATCH30MAR202431MAR20246.21840PhiMAR20241Moderate Risk
16EQ016NewzealandLowADVISORY15APR202416APR20245.91433NewAPR20241Low Risk
17EQ013GreeceLowADVISORY02JAN202403JAN20245.81230GreJAN20241Low Risk
18EQ014AfghanistanSevereWARNING18FEB202419FEB20246.72858AfgFEB20241Moderate Risk
19EQ015PhilippinesModerateWATCH30MAR202431MAR20246.21840PhiMAR20241Moderate Risk
20EQ016NewzealandLowADVISORY15APR202416APR20245.91433NewAPR20241Low Risk

MERGE

proc sort data=earthquakes_risk; by Country; run;

proc print data=earthquakes_risk;

run;

OUTPUT:

ObsEarthquake_IDCountryDamage_LevelAlert_TypeEvent_DateReport_DateMagnitudeDepth_kmDuration_SecondsCountry_CodeEvent_MonthDays_To_ReportSeismic_Risk
1EQ014AfghanistanSevereWARNING18FEB202419FEB20246.72858AfgFEB20241Moderate Risk
2EQ014AfghanistanSevereWARNING18FEB202419FEB20246.72858AfgFEB20241Moderate Risk
3EQ003ChileModerateADVISORY20MAR202321MAR20236.11038ChiMAR20231Moderate Risk
4EQ012ChinaSevereWARNING09DEC202310DEC20237.53580ChiDEC20231High Risk
5EQ013GreeceLowADVISORY02JAN202403JAN20245.81230GreJAN20241Low Risk
6EQ013GreeceLowADVISORY02JAN202403JAN20245.81230GreJAN20241Low Risk
7EQ001IndiaModerateWATCH01JAN202302JAN20236.51545IndJAN20231Moderate Risk
8EQ005IndonesiaSevereWARNING15MAY202316MAY20237.22565IndMAY20231High Risk
9EQ010IranSevereWARNING14OCT202315OCT20236.92260IraOCT20231Moderate Risk
10EQ009ItalyLowADVISORY03SEP202304SEP20235.71028ItaSEP20231Low Risk
11EQ002JapanSevereWARNING12FEB202313FEB20237.83070JapFEB20231High Risk
12EQ008MexicoModerateWATCH22AUG202323AUG20236.32048MexAUG20231Moderate Risk
13EQ004NepalLowADVISORY05APR202306APR20235.91232NepAPR20231Low Risk
14EQ016NewzealandLowADVISORY15APR202416APR20245.91433NewAPR20241Low Risk
15EQ016NewzealandLowADVISORY15APR202416APR20245.91433NewAPR20241Low Risk
16EQ011PeruModerateWATCH28NOV202329NOV20236.41542PerNOV20231Moderate Risk
17EQ015PhilippinesModerateWATCH30MAR202431MAR20246.21840PhiMAR20241Moderate Risk
18EQ015PhilippinesModerateWATCH30MAR202431MAR20246.21840PhiMAR20241Moderate Risk
19EQ006TurkeySevereWARNING01JUN202302JUN20236.81855TurJUN20231Moderate Risk
20EQ007UsaLowADVISORY10JUL202311JUL20235.5825UsaJUL20231Low Risk


proc sort data=country_summary; by Country; run;

proc print data=country_summary;

run;

OUTPUT:

ObsCountryTotal_EventsAvg_MagnitudeAvg_Depth
1Afghanistan16.7028.00
2Chile16.1010.00
3China17.5035.00
4Greece15.8012.00
5India16.5015.00
6Indonesia17.2025.00
7Iran16.9022.00
8Italy15.7010.00
9Japan17.8030.00
10Mexico16.3020.00
11Nepal15.9012.00
12Newzealand15.9014.00
13Peru16.4015.00
14Philippines16.2018.00
15Turkey16.8018.00
16Usa15.508.00


data merged_data;

    merge earthquakes_risk 

          country_summary;

    by Country;

run;

proc print data=merged_data;

run;

OUTPUT:

ObsEarthquake_IDCountryDamage_LevelAlert_TypeEvent_DateReport_DateMagnitudeDepth_kmDuration_SecondsCountry_CodeEvent_MonthDays_To_ReportSeismic_RiskTotal_EventsAvg_MagnitudeAvg_Depth
1EQ014AfghanistanSevereWARNING18FEB202419FEB20246.72858AfgFEB20241Moderate Risk16.7028.00
2EQ014AfghanistanSevereWARNING18FEB202419FEB20246.72858AfgFEB20241Moderate Risk16.7028.00
3EQ003ChileModerateADVISORY20MAR202321MAR20236.11038ChiMAR20231Moderate Risk16.1010.00
4EQ012ChinaSevereWARNING09DEC202310DEC20237.53580ChiDEC20231High Risk17.5035.00
5EQ013GreeceLowADVISORY02JAN202403JAN20245.81230GreJAN20241Low Risk15.8012.00
6EQ013GreeceLowADVISORY02JAN202403JAN20245.81230GreJAN20241Low Risk15.8012.00
7EQ001IndiaModerateWATCH01JAN202302JAN20236.51545IndJAN20231Moderate Risk16.5015.00
8EQ005IndonesiaSevereWARNING15MAY202316MAY20237.22565IndMAY20231High Risk17.2025.00
9EQ010IranSevereWARNING14OCT202315OCT20236.92260IraOCT20231Moderate Risk16.9022.00
10EQ009ItalyLowADVISORY03SEP202304SEP20235.71028ItaSEP20231Low Risk15.7010.00
11EQ002JapanSevereWARNING12FEB202313FEB20237.83070JapFEB20231High Risk17.8030.00
12EQ008MexicoModerateWATCH22AUG202323AUG20236.32048MexAUG20231Moderate Risk16.3020.00
13EQ004NepalLowADVISORY05APR202306APR20235.91232NepAPR20231Low Risk15.9012.00
14EQ016NewzealandLowADVISORY15APR202416APR20245.91433NewAPR20241Low Risk15.9014.00
15EQ016NewzealandLowADVISORY15APR202416APR20245.91433NewAPR20241Low Risk15.9014.00
16EQ011PeruModerateWATCH28NOV202329NOV20236.41542PerNOV20231Moderate Risk16.4015.00
17EQ015PhilippinesModerateWATCH30MAR202431MAR20246.21840PhiMAR20241Moderate Risk16.2018.00
18EQ015PhilippinesModerateWATCH30MAR202431MAR20246.21840PhiMAR20241Moderate Risk16.2018.00
19EQ006TurkeySevereWARNING01JUN202302JUN20236.81855TurJUN20231Moderate Risk16.8018.00
20EQ007UsaLowADVISORY10JUL202311JUL20235.5825UsaJUL20231Low Risk15.508.00


13. PROC COPY (Library Management)

libname backup "path";

LOG:

NOTE: Libref BACKUP was successfully assigned as follows:

proc copy in=work out=backup;

    select earthquakes_risk country_summary;

run;

LOG:

NOTE: Copying WORK.EARTHQUAKES_RISK to BACKUP.EARTHQUAKES_RISK (memtype=DATA).
NOTE: There were 20 observations read from the data set WORK.EARTHQUAKES_RISK.
NOTE: The data set BACKUP.EARTHQUAKES_RISK has 20 observations and 13 variables.
NOTE: Copying WORK.COUNTRY_SUMMARY to BACKUP.COUNTRY_SUMMARY (memtype=DATA).
NOTE: There were 16 observations read from the data set WORK.COUNTRY_SUMMARY.
NOTE: The data set BACKUP.COUNTRY_SUMMARY has 16 observations and 4 variables.

14.Delete Specific Datasets

proc datasets library=backup nolist;

   delete earthquakes_risk country_summary;

quit;

LOG:

NOTE: Deleting BACKUP.EARTHQUAKES_RISK (memtype=DATA).
NOTE: Deleting BACKUP.COUNTRY_SUMMARY (memtype=DATA).

15. What We Are Learning (Interview Perspective)

Here demonstrating:

·       Real-world dataset modeling

·       Production-quality DATA step programming

·       Advanced function usage

·       Macro-driven classification

·       Statistical interpretation

·       Visualization competency

·       Enterprise dataset movement

·       Strong foundation for disaster analytics roles


16. Practical Use Cases

·       Government disaster response units

·       Early warning systems

·       Insurance risk modeling

·       Urban infrastructure planning

·       Research and academic studies


17. Why This Project Is Strong for Interviews

Interviewers immediately see:

·       Logical thinking

·       Data engineering skills

·       Statistical understanding

·       Automation capability

·       Clean, readable, maintainable SAS code


18. Conclusion

This Global Earthquake Analytics SAS Project is a complete, professional, interview-ready solution that integrates DATA step mastery, PROC SQL, statistical procedures, macros, date intelligence, and visualization.

If you can explain and write this level of SAS code, you are well above entry-level and moving confidently toward mid-to-senior SAS programmer roles.


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

184.HOW TO CREATE MOCK SHELLS AND CLINICAL DATA LISTINGS IN SAS USING DATA NULL | PROC PRINT | PROC REPORT | PROC SORT | PROC COMPARE | ODS PDF | ODS RTF | ODS EXCEL | A COMPLETE STEP-BY-STEP GUIDE FOR CLINICAL SAS PROGRAMMERS

62.ADDING NEW DATA INTO AVAILABLE DATA USING MERGE

341.FAMOUS SCIENTISTS DATA ANALYSIS USING PROC SQL | PROC MEANS | PROC RANK | PROC FORMAT | PROC SGPLOT | MACROS | DATE FUNCTIONS FOR IMPACT EVALUATION | RANKING INSIGHTS | TIME-BASED SCIENTIFIC CONTRIBUTION STUDY