396.Are high-security border checkpoints always more efficient, or do they slow down trade?A Complete Sas Analytics Data

Are high-security border checkpoints always more efficient, or do they slow down trade?A Complete Sas Analytics Data

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

HERE IN THIS PROJECT WE USED THESE SAS STATEMENTS —
DATA STEP | PROC SQL |  PROC PRINT | PROC SGPLOT | MACROS | PROC CORR | PROC MEANS | PROC FREQ | PROC UNIVARIATE | PROC TRANSPOSE | PROC DATASETS DELETE | DATA FUNCTIONS

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

TABLE OF CONTENTS

1.     Introduction

2.     Business Context

3.     Dataset Design & Variables

4.     SAS Environment Setup

5.     Raw Dataset Creation (10 Observations)

6.     Character & Numeric Data Cleaning

7.     Date Creation & Formatting (MDY, INTCK, INTNX)

8.     Utilization Classification Macro

9.     Fraud Detection Macro Logic

10.  PROC SQL Analytics

11.  PROC FREQ Analysis

12.  PROC MEANS Analysis

13.  PROC UNIVARIATE Analysis

14.  PROC CORR Analysis

15.  PROC SGPLOT Visualizations

16.  TRANSPOSE Usage

17.  PROC DATASETS 

18.  Business Insights

19.  Interview Talking Points

20.  Conclusion

1. INTRODUCTION

Border trade checkpoints are critical economic gateways between countries.
They manage:

·       Import & export goods

·       Vehicle movement

·       Customs clearance

·       Security enforcement

·       Revenue protection

Analyzing checkpoint efficiency helps governments:

·       Reduce clearance delays

·       Detect fraud

·       Improve logistics efficiency

·       Optimize security allocation

This SAS project simulates a real-world border trade analytics system.

2. BUSINESS CONTEXT

Problem Statement:
Government authorities want to evaluate:

·       How efficient each checkpoint is

·       Whether high goods value aligns with traffic volume

·       Which checkpoints show fraud risk patterns

·       Where clearance delays occur

·       How security level impacts performance

Business Users:

·       Customs Department

·       Border Security Agencies

·       Trade & Commerce Ministry

·       Logistics & Transport Authorities

3.  DATASET DESIGN & VARIABLES

Variable

Type

Description

Checkpoint_Name

Character

Border checkpoint name

Country

Character

Country where checkpoint exists

Trade_Date

Numeric (Date)

Operational date

Daily_Vehicles

Numeric

Vehicles crossing per day

Goods_Value

Numeric

Value of goods (Million USD)

Clearance_Time

Numeric

Avg clearance time (hours)

Security_Level

Character

LOW / MEDIUM / HIGH

Efficiency_Rating

Numeric

Efficiency percentage

Fraud_Flag

Character

Y / N

Utilization_Class

Character

LOW / MEDIUM / HIGH

4. SAS ENVIRONMENT SETUP

options nocenter nodate nonumber;

title;

footnote;

LOG:
69 options nocenter nodate nonumber;
70 title;
71 footnote;

• Ensures clean output • Removes distractions in reports • Professional reporting practice

5. RAW DATASET CREATION

data border_trade_raw;

    length

        Checkpoint_Name   $25

        Country           $15

        Security_Level    $8;

    format Trade_Date date9.;

    input

        Checkpoint_Name   :& $25.

        Country           :$15.

        Trade_Date        :date9.

        Daily_Vehicles

        Goods_Value

        Clearance_Time

        Security_Level    :$8.

        Efficiency_Rating

    ;

datalines;

Attari Border        India        02JAN2025  980   72   5  HIGH   82

Wagah Post           India        01JAN2025 1200   85   6  HIGH   78

Petrapole            India        03JAN2025 1500   95   8  MEDIUM 70

Moreh Checkpost      India        04JAN2025  600   40   9  LOW    55

Raxaul Border        India        05JAN2025 1100   65   7  MEDIUM 68

Benapole             Bangladesh  01JAN2025 1400   90   6  MEDIUM 75

Chittagong Port      Bangladesh  02JAN2025 1800  120   4  HIGH   88

Torkham              Pakistan    01JAN2025 1600  110   7  HIGH   80

Islam Qala           Afghanistan 02JAN2025  750   55   8  MEDIUM 65

Zamyn Uud            Mongolia    01JAN2025  650   42   9  LOW    58

;

run;

proc print data=border_trade_raw;

run;

OUTPUT:
ObsCheckpoint_NameCountrySecurity_LevelTrade_DateDaily_VehiclesGoods_ValueClearance_TimeEfficiency_Rating
1Attari BorderIndiaHIGH02JAN202598072582
2Wagah PostIndiaHIGH01JAN2025120085678
3PetrapoleIndiaMEDIUM03JAN2025150095870
4Moreh CheckpostIndiaLOW04JAN202560040955
5Raxaul BorderIndiaMEDIUM05JAN2025110065768
6BenapoleBangladeshMEDIUM01JAN2025140090675
7Chittagong PortBangladeshHIGH02JAN20251800120488
8TorkhamPakistanHIGH01JAN20251600110780
9Islam QalaAfghanistanMEDIUM02JAN202575055865
10Zamyn UudMongoliaLOW01JAN202565042958

·  DATALINES simulate real operational data

·  date9. ensures proper SAS date handling

·  Realistic operational values used

6. CHARACTER & NUMERIC DATA CLEANING

data border_trade_clean;

    set border_trade_raw;

    Checkpoint_Name = propcase(strip(Checkpoint_Name));

    Country = upcase(trim(Country));

    Security_Level = upcase(Security_Level);

    Goods_Value_USD = round(Goods_Value * 1000000, 1);

    Vehicle_Load_Ratio = Daily_Vehicles / Clearance_Time;

run;

proc print data=border_trade_clean;

run;

OUTPUT:
ObsCheckpoint_NameCountrySecurity_LevelTrade_DateDaily_VehiclesGoods_ValueClearance_TimeEfficiency_RatingGoods_Value_USDVehicle_Load_Ratio
1Attari BorderINDIAHIGH02JAN20259807258272000000196.000
2Wagah PostINDIAHIGH01JAN202512008567885000000200.000
3PetrapoleINDIAMEDIUM03JAN202515009587095000000187.500
4Moreh CheckpostINDIALOW04JAN2025600409554000000066.667
5Raxaul BorderINDIAMEDIUM05JAN202511006576865000000157.143
6BenapoleBANGLADESHMEDIUM01JAN202514009067590000000233.333
7Chittagong PortBANGLADESHHIGH02JAN20251800120488120000000450.000
8TorkhamPAKISTANHIGH01JAN20251600110780110000000228.571
9Islam QalaAFGHANISTANMEDIUM02JAN2025750558655500000093.750
10Zamyn UudMONGOLIALOW01JAN2025650429584200000072.222

·  striptrim → remove unwanted spaces

·  propcaseupcase → standard formatting

·  Derived metrics improve analytics depth

7. DATE FUNCTIONS (MDY, INTCK, INTNX)

data border_trade_dates;

    set border_trade_clean;

    Month_Start = intnx('month', Trade_Date, 0, 'b');

    Days_From_Start = intck('day', '01JAN2025'd, Trade_Date);

    Custom_Date = mdy(month(Trade_Date), day(Trade_Date), year(Trade_Date));

run;

proc print data=border_trade_dates;

run;

OUTPUT:
ObsCheckpoint_NameCountrySecurity_LevelTrade_DateDaily_VehiclesGoods_ValueClearance_TimeEfficiency_RatingGoods_Value_USDVehicle_Load_RatioMonth_StartDays_From_StartCustom_Date
1Attari BorderINDIAHIGH02JAN20259807258272000000196.00023742123743
2Wagah PostINDIAHIGH01JAN202512008567885000000200.00023742023742
3PetrapoleINDIAMEDIUM03JAN202515009587095000000187.50023742223744
4Moreh CheckpostINDIALOW04JAN2025600409554000000066.66723742323745
5Raxaul BorderINDIAMEDIUM05JAN202511006576865000000157.14323742423746
6BenapoleBANGLADESHMEDIUM01JAN202514009067590000000233.33323742023742
7Chittagong PortBANGLADESHHIGH02JAN20251800120488120000000450.00023742123743
8TorkhamPAKISTANHIGH01JAN20251600110780110000000228.57123742023742
9Islam QalaAFGHANISTANMEDIUM02JAN2025750558655500000093.75023742123743
10Zamyn UudMONGOLIALOW01JAN2025650429584200000072.22223742023742

·  INTNX → reporting periods

·  INTCK → gap analysis

·  MDY → date reconstruction

8. UTILIZATION CLASSIFICATION MACRO

%macro utilization_class;

data border_trade_util;

    set border_trade_dates;

    length Utilization_Class $8.;

    if Daily_Vehicles >= 1500 then Utilization_Class = 'HIGH';

    else if Daily_Vehicles >= 900 then Utilization_Class = 'MEDIUM';

    else Utilization_Class = 'LOW';

run;

proc print data=border_trade_util;

run;

%mend;


%utilization_class;

OUTPUT:
ObsCheckpoint_NameCountrySecurity_LevelTrade_DateDaily_VehiclesGoods_ValueClearance_TimeEfficiency_RatingGoods_Value_USDVehicle_Load_RatioMonth_StartDays_From_StartCustom_DateUtilization_Class
1Attari BorderINDIAHIGH02JAN20259807258272000000196.00023742123743MEDIUM
2Wagah PostINDIAHIGH01JAN202512008567885000000200.00023742023742MEDIUM
3PetrapoleINDIAMEDIUM03JAN202515009587095000000187.50023742223744HIGH
4Moreh CheckpostINDIALOW04JAN2025600409554000000066.66723742323745LOW
5Raxaul BorderINDIAMEDIUM05JAN202511006576865000000157.14323742423746MEDIUM
6BenapoleBANGLADESHMEDIUM01JAN202514009067590000000233.33323742023742MEDIUM
7Chittagong PortBANGLADESHHIGH02JAN20251800120488120000000450.00023742123743HIGH
8TorkhamPAKISTANHIGH01JAN20251600110780110000000228.57123742023742HIGH
9Islam QalaAFGHANISTANMEDIUM02JAN2025750558655500000093.75023742123743LOW
10Zamyn UudMONGOLIALOW01JAN2025650429584200000072.22223742023742LOW

·  Reusable logic

·  Consistency across datasets

·  Automation 

9. FRAUD DETECTION MACRO LOGIC

%macro fraud_logic;

data border_trade_fraud;

    set border_trade_util;


    if Goods_Value > 100 and Daily_Vehicles < 800 then Fraud_Flag='Y';

    else if Clearance_Time > 9 then Fraud_Flag='Y';

    else Fraud_Flag='N';

run;

proc print data=border_trade_fraud;

run;

%mend;


%fraud_logic;

OUTPUT:
ObsCheckpoint_NameCountrySecurity_LevelTrade_DateDaily_VehiclesGoods_ValueClearance_TimeEfficiency_RatingGoods_Value_USDVehicle_Load_RatioMonth_StartDays_From_StartCustom_DateUtilization_ClassFraud_Flag
1Attari BorderINDIAHIGH02JAN20259807258272000000196.00023742123743MEDIUMN
2Wagah PostINDIAHIGH01JAN202512008567885000000200.00023742023742MEDIUMN
3PetrapoleINDIAMEDIUM03JAN202515009587095000000187.50023742223744HIGHN
4Moreh CheckpostINDIALOW04JAN2025600409554000000066.66723742323745LOWN
5Raxaul BorderINDIAMEDIUM05JAN202511006576865000000157.14323742423746MEDIUMN
6BenapoleBANGLADESHMEDIUM01JAN202514009067590000000233.33323742023742MEDIUMN
7Chittagong PortBANGLADESHHIGH02JAN20251800120488120000000450.00023742123743HIGHN
8TorkhamPAKISTANHIGH01JAN20251600110780110000000228.57123742023742HIGHN
9Islam QalaAFGHANISTANMEDIUM02JAN2025750558655500000093.75023742123743LOWN
10Zamyn UudMONGOLIALOW01JAN2025650429584200000072.22223742023742LOWN

·  High value + low volume = possible under-reporting

·  Long clearance = inspection or irregularities

10. PROC SQL ANALYTICS

proc sql;

    create table country_summary as

    select Country,

           count(*) as Checkpoints,

           avg(Daily_Vehicles) as Avg_Vehicles,

           avg(Goods_Value) as Avg_Goods_Value,

           avg(Efficiency_Rating) as Avg_Efficiency

    from border_trade_fraud

    group by Country;

quit;

proc print data=country_summary;

run;

OUTPUT:
ObsCountryCheckpointsAvg_VehiclesAvg_Goods_ValueAvg_Efficiency
1AFGHANISTAN175055.065.0
2BANGLADESH21600105.081.5
3INDIA5107671.470.6
4MONGOLIA165042.058.0
5PAKISTAN11600110.080.0

·  Flexible aggregation

·  Industry standard

·  Required for ADaM & reporting

11. PROC FREQ

proc freq data=border_trade_fraud;

    tables Security_Level*Fraud_Flag / norow nocol;

run;

OUTPUT:

The FREQ Procedure

Frequency
Percent
Table of Security_Level by Fraud_Flag
Security_LevelFraud_Flag
NTotal
HIGH
4
40.00
4
40.00
LOW
2
20.00
2
20.00
MEDIUM
4
40.00
4
40.00
Total
10
100.00
10
100.00

·  Categorical relationships

·  Fraud vs security strength analysis

12. PROC MEANS

proc means data=border_trade_fraud mean min max std;

    var Daily_Vehicles Goods_Value Clearance_Time Efficiency_Rating;

run;

OUTPUT:

The MEANS Procedure

VariableMeanMinimumMaximumStd Dev
Daily_Vehicles
Goods_Value
Clearance_Time
Efficiency_Rating
1158.00
77.4000000
6.9000000
71.9000000
600.0000000
40.0000000
4.0000000
55.0000000
1800.00
120.0000000
9.0000000
88.0000000
415.7670288
27.3666464
1.6633300
10.6400710

13. PROC UNIVARIATE

proc univariate data=border_trade_fraud;

    var Clearance_Time Efficiency_Rating;

    histogram Clearance_Time;

run;

OUTPUT:

The UNIVARIATE Procedure

Variable: Clearance_Time

Moments
N10Sum Weights10
Mean6.9Sum Observations69
Std Deviation1.66332999Variance2.76666667
Skewness-0.347684Kurtosis-0.7210252
Uncorrected SS501Corrected SS24.9
Coeff Variation24.1062318Std Error Mean0.52599113
Basic Statistical Measures
LocationVariability
Mean6.900000Std Deviation1.66333
Median7.000000Variance2.76667
Mode6.000000Range5.00000
  Interquartile Range2.00000

Note: The mode displayed is the smallest of 4 modes with a count of 2.

Tests for Location: Mu0=0
TestStatisticp Value
Student's tt13.11809Pr > |t|<.0001
SignM5Pr >= |M|0.0020
Signed RankS27.5Pr >= |S|0.0020
Quantiles (Definition 5)
LevelQuantile
100% Max9.0
99%9.0
95%9.0
90%9.0
75% Q38.0
50% Median7.0
25% Q16.0
10%4.5
5%4.0
1%4.0
0% Min4.0
Extreme Observations
LowestHighest
ValueObsValueObs
4778
5183
6689
6294
78910

The UNIVARIATE Procedure

Histogram for Clearance_Time

The UNIVARIATE Procedure

Variable: Efficiency_Rating

Moments
N10Sum Weights10
Mean71.9Sum Observations719
Std Deviation10.640071Variance113.211111
Skewness-0.2208387Kurtosis-0.8519282
Uncorrected SS52715Corrected SS1018.9
Coeff Variation14.7984298Std Error Mean3.36468589
Basic Statistical Measures
LocationVariability
Mean71.90000Std Deviation10.64007
Median72.50000Variance113.21111
Mode.Range33.00000
  Interquartile Range15.00000
Tests for Location: Mu0=0
TestStatisticp Value
Student's tt21.36901Pr > |t|<.0001
SignM5Pr >= |M|0.0020
Signed RankS27.5Pr >= |S|0.0020
Quantiles (Definition 5)
LevelQuantile
100% Max88.0
99%88.0
95%88.0
90%85.0
75% Q380.0
50% Median72.5
25% Q165.0
10%56.5
5%55.0
1%55.0
0% Min55.0
Extreme Observations
LowestHighest
ValueObsValueObs
554756
5810782
659808
685821
703887

14. PROC CORR

proc corr data=border_trade_fraud;

    var Daily_Vehicles Goods_Value Clearance_Time Efficiency_Rating;

run;

OUTPUT:

The CORR Procedure

4 Variables:Daily_Vehicles Goods_Value Clearance_Time Efficiency_Rating
Simple Statistics
VariableNMeanStd DevSumMinimumMaximum
Daily_Vehicles101158415.7670311580600.000001800
Goods_Value1077.4000027.36665774.0000040.00000120.00000
Clearance_Time106.900001.6633369.000004.000009.00000
Efficiency_Rating1071.9000010.64007719.0000055.0000088.00000
Pearson Correlation Coefficients, N = 10
Prob > |r| under H0: Rho=0
 Daily_VehiclesGoods_ValueClearance_TimeEfficiency_Rating
Daily_Vehicles
1.00000
 
0.98452
<.0001
-0.65103
0.0415
0.80394
0.0051
Goods_Value
0.98452
<.0001
1.00000
 
-0.70201
0.0236
0.86788
0.0011
Clearance_Time
-0.65103
0.0415
-0.70201
0.0236
1.00000
 
-0.92980
<.0001
Efficiency_Rating
0.80394
0.0051
0.86788
0.0011
-0.92980
<.0001
1.00000
 

·  Efficiency vs clearance time

·  Vehicles vs goods value dependency

15. PROC SGPLOT

proc sgplot data=border_trade_fraud;

    scatter x=Daily_Vehicles y=Efficiency_Rating;

    reg x=Daily_Vehicles y=Efficiency_Rating;

run;

OUTPUT:
The SGPlot Procedure

16. TRANSPOSE

proc transpose data=country_summary 

               out=country_transposed;

run;

proc print data=country_transposed;

run;

OUTPUT:
Obs_NAME_COL1COL2COL3COL4COL5
1Checkpoints12.05.011
2Avg_Vehicles7501600.01076.06501600
3Avg_Goods_Value55105.071.442110
4Avg_Efficiency6581.570.65880

17. PROC DATASETS

proc datasets lib=work nolist;

    delete border_trade_raw;

quit;

LOG:

NOTE: Deleting WORK.BORDER_TRADE_RAW (memtype=DATA).

18.  BUSINESS INSIGHTS

·       High security does not always mean lower fraud

·       Clearance time strongly affects efficiency

·       Some low-volume checkpoints handle high-value goods

·       Automation improves monitoring accuracy

19.  INTERVIEW TALKING POINTS

·       Why macros over hard coding

·       Fraud detection logic explanation

·       Date function differences

·       PROC SQL vs DATA STEP

·       Visualization interpretation

20. CONCLUSION

This Border Trade Checkpoints Analytics project shows how SAS can turn raw border movement data into meaningful business insights.
By analyzing vehicles, goods value, clearance time, security level, and efficiency, we can identify delays, detect possible fraud patterns, and measure checkpoint performance.

Using PROC SQL, statistical procedures, macros, and date functions, this project demonstrates how data-driven decisions can improve border security, trade efficiency, and revenue protection.
Overall, it proves that smart analytics leads to safer borders and faster trade.


INTERVIEW QUESTIONS FOR YOU

·  What is CALL EXECUTE?

·  What is SAS Metadata?

·  What is SAS Grid?

 

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

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 BORDER CHECKPOINTS data.


Our Mission:

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


This project is suitable for:

·  Students learning SAS

·  Data analysts building portfolios

·  Professionals preparing for SAS interviews

·  Bloggers writing about analytics and smart cities

·  EV and energy industry professionals

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Follow Us On : 


 
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

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

---> Support Us By Following Our Blog..

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

1.Is there a strong relationship between employment rate and poverty reduction across states?A Complete Sas Study

2.Which mobile payment apps handle the highest number of transactions, and are they truly the most reliable?

3.Which namkeen products sell the most, and what does SAS data creation reveal about customer taste?A Sas Study

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

About Us | Contact Privacy Policy

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

379.CAN SAS DELIVER END-TO-END TLF (TABLES, LISTINGS, AND FIGURES) FOR INSURANCE CLAIMS ANALYSIS?

383.Which Pharma Distributors Are High-Risk? Can SAS Detect Delays, Temperature Violations, and Fraud?