384.Is your factory really performing well, or just showing good numbers on paper?Using Sas Can we Get it

Is your factory really performing well, or just showing good numbers on paper?Using Sas Can we Get it

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 | APPEND | PROC SORT | MERGE | PROC DATASETS DELETE


INTRODUCTION

In modern manufacturing industries, factory production lines are the backbone of operational efficiency. Every production line consumes energy, produces goods, generates defects, and experiences downtime. Monitoring these variables continuously is critical for:

  • Operational efficiency
  • Cost control
  • Quality assurance
  • Fraud or data manipulation detection
  • Predictive maintenance

This project simulates a real-world industrial analytics scenario where a data analyst or SAS programmer is asked to:

  1. Create production data
  2. Perform descriptive and statistical analysis
  3. Detect abnormal or fraudulent patterns
  4. Classify utilization
  5. Visualize performance
  6. Provide business insights

CONTENTS

  1. Dataset Creation
  2. Date Handling using MDY / INTCK / INTNX
  3. Character & Numeric Transformations
  4. Utilization Classification Macro
  5. Fraud Detection Macro
  6. Statistical Analysis
  7. Correlation Analysis
  8. Visualization
  9. Transpose & Reshaping
  10. Merging & Appending
  11. PROC DATASETS Cleanup
  12. Final Business Insights


STEP 1 — DATASET CREATION

data factory_lines;

    input Line_ID $ Product_Type $ Units_Produced Defect_Rate 

          Downtime_Hours Energy_Consumption Efficiency_Score Production_Date :date9.;

   format Production_Date date9.; 

datalines;

L01 electronics 1200 2.5 1.2 450 88 01JAN2024

L02 furniture 950 3.8 2.4 520 82 03JAN2024

L03 electronics 1500 1.2 0.5 610 92 05JAN2024

L04 automotive 1800 4.9 3.8 900 75 06JAN2024

L05 textile 700 5.5 4.2 300 70 08JAN2024

L06 electronics 1600 1.5 0.7 650 93 10JAN2024

L07 furniture 1100 2.9 1.5 480 85 11JAN2024

L08 automotive 1900 6.1 5.0 950 68 13JAN2024

L09 textile 800 4.2 3.0 350 74 14JAN2024

L10 electronics 1400 2.0 1.0 590 90 16JAN2024

L11 furniture 1000 3.5 2.0 500 83 18JAN2024

L12 automotive 2000 7.5 6.0 1000 65 20JAN2024

L13 textile 750 4.8 3.6 330 72 21JAN2024

L14 electronics 1700 1.1 0.4 680 95 23JAN2024

L15 automotive 2100 8.2 7.0 1100 60 25JAN2024

;

run;

proc print data=factory_lines;

run;

OUTPUT:

ObsLine_IDProduct_TypeUnits_ProducedDefect_RateDowntime_HoursEnergy_ConsumptionEfficiency_ScoreProduction_Date
1L01electron12002.51.24508801JAN2024
2L02furnitur9503.82.45208203JAN2024
3L03electron15001.20.56109205JAN2024
4L04automoti18004.93.89007506JAN2024
5L05textile7005.54.23007008JAN2024
6L06electron16001.50.76509310JAN2024
7L07furnitur11002.91.54808511JAN2024
8L08automoti19006.15.09506813JAN2024
9L09textile8004.23.03507414JAN2024
10L10electron14002.01.05909016JAN2024
11L11furnitur10003.52.05008318JAN2024
12L12automoti20007.56.010006520JAN2024
13L13textile7504.83.63307221JAN2024
14L14electron17001.10.46809523JAN2024
15L15automoti21008.27.011006025JAN2024

Simulates MES (Manufacturing Execution System) feed.
Represents line-wise production KPIs.

Used in interviews to show:

·       Domain understanding

·       Realistic variable naming

·       Correct data types


STEP 2 — DATE LOGIC (MDY, INTCK, INTNX)

data factory_dates;

    set factory_lines;

    Report_Date = mdy(2,1,2024);

    Days_From_Report = intck('day', Production_Date, Report_Date);

    Next_Service_Date = intnx('month', Production_Date, 1);

run;

proc print data=factory_dates;

  var Line_ID Product_Type Production_Date Report_Date Days_From_Report Next_Service_Date;

run;

OUTPUT:

ObsLine_IDProduct_TypeProduction_DateReport_DateDays_From_ReportNext_Service_Date
1L01electron01JAN2024234073123407
2L02furnitur03JAN2024234072923407
3L03electron05JAN2024234072723407
4L04automoti06JAN2024234072623407
5L05textile08JAN2024234072423407
6L06electron10JAN2024234072223407
7L07furnitur11JAN2024234072123407
8L08automoti13JAN2024234071923407
9L09textile14JAN2024234071823407
10L10electron16JAN2024234071623407
11L11furnitur18JAN2024234071423407
12L12automoti20JAN2024234071223407
13L13textile21JAN2024234071123407
14L14electron23JAN202423407923407
15L15automoti25JAN202423407723407

Function

Purpose

MDY

Creates reference reporting date

INTCK

Measures operational lag

INTNX

Schedules next maintenance

Used in:

  • SLA tracking
  • Preventive maintenance systems

STEP 3 — CHARACTER & NUMERIC FUNCTIONS

data factory_clean;

    set factory_dates;

    Product_Type_Upper = upcase(Product_Type);

    Product_Type_Proper = propcase(Product_Type);

    Product_Key = catx('_', Line_ID, Product_Type);

    Defect_Adjusted = coalesce(Defect_Rate,0);

run;

proc print data=factory_clean;

  var Line_ID Product_Type Product_Type_Upper Product_Type_Proper Product_Key Defect_Rate Defect_Adjusted;

run;

OUTPUT:

ObsLine_IDProduct_TypeProduct_Type_UpperProduct_Type_ProperProduct_KeyDefect_RateDefect_Adjusted
1L01electronELECTRONElectronL01_electron2.52.5
2L02furniturFURNITURFurniturL02_furnitur3.83.8
3L03electronELECTRONElectronL03_electron1.21.2
4L04automotiAUTOMOTIAutomotiL04_automoti4.94.9
5L05textileTEXTILETextileL05_textile5.55.5
6L06electronELECTRONElectronL06_electron1.51.5
7L07furniturFURNITURFurniturL07_furnitur2.92.9
8L08automotiAUTOMOTIAutomotiL08_automoti6.16.1
9L09textileTEXTILETextileL09_textile4.24.2
10L10electronELECTRONElectronL10_electron2.02.0
11L11furniturFURNITURFurniturL11_furnitur3.53.5
12L12automotiAUTOMOTIAutomotiL12_automoti7.57.5
13L13textileTEXTILETextileL13_textile4.84.8
14L14electronELECTRONElectronL14_electron1.11.1
15L15automotiAUTOMOTIAutomotiL15_automoti8.28.2

Function

Business Use

UPCASE

Standardization

PROPCASE

Reporting

CATX

Unique keys

COALESCE

Missing handling


STEP 4 — UTILIZATION CLASSIFICATION MACRO

%macro utilization;

data factory_util;

    set factory_clean;

    if Efficiency_Score >= 90 then Utilization="Excellent";

    else if Efficiency_Score >= 80 then Utilization="Good";

    else if Efficiency_Score >= 70 then Utilization="Average";

    else Utilization="Poor";

run;

proc print data=factory_util;

run;

%mend;


%utilization;

OUTPUT:

ObsLine_IDProduct_TypeUnits_ProducedDefect_RateDowntime_HoursEnergy_ConsumptionEfficiency_ScoreProduction_DateReport_DateDays_From_ReportNext_Service_DateProduct_Type_UpperProduct_Type_ProperProduct_KeyDefect_AdjustedUtilization
1L01electron12002.51.24508801JAN2024234073123407ELECTRONElectronL01_electron2.5Good
2L02furnitur9503.82.45208203JAN2024234072923407FURNITURFurniturL02_furnitur3.8Good
3L03electron15001.20.56109205JAN2024234072723407ELECTRONElectronL03_electron1.2Excellent
4L04automoti18004.93.89007506JAN2024234072623407AUTOMOTIAutomotiL04_automoti4.9Average
5L05textile7005.54.23007008JAN2024234072423407TEXTILETextileL05_textile5.5Average
6L06electron16001.50.76509310JAN2024234072223407ELECTRONElectronL06_electron1.5Excellent
7L07furnitur11002.91.54808511JAN2024234072123407FURNITURFurniturL07_furnitur2.9Good
8L08automoti19006.15.09506813JAN2024234071923407AUTOMOTIAutomotiL08_automoti6.1Poor
9L09textile8004.23.03507414JAN2024234071823407TEXTILETextileL09_textile4.2Average
10L10electron14002.01.05909016JAN2024234071623407ELECTRONElectronL10_electron2.0Excellent
11L11furnitur10003.52.05008318JAN2024234071423407FURNITURFurniturL11_furnitur3.5Good
12L12automoti20007.56.010006520JAN2024234071223407AUTOMOTIAutomotiL12_automoti7.5Poor
13L13textile7504.83.63307221JAN2024234071123407TEXTILETextileL13_textile4.8Average
14L14electron17001.10.46809523JAN202423407923407ELECTRONElectronL14_electron1.1Excellent
15L15automoti21008.27.011006025JAN202423407723407AUTOMOTIAutomotiL15_automoti8.2Poor

Automates:

·       Plant dashboards

·       KPI categorization

·       Performance banding

Shows:

·       Reusability

·       Enterprise coding style


STEP 5 — FRAUD DETECTION MACRO

%macro fraud;

data factory_fraud;

    set factory_util;

    if Defect_Rate > 7 and Downtime_Hours > 5 then Fraud_Flag="YES";

    else Fraud_Flag="NO";

run;

proc print data=factory_fraud;

run;

%mend;


%fraud;

OUTPUT:

ObsLine_IDProduct_TypeUnits_ProducedDefect_RateDowntime_HoursEnergy_ConsumptionEfficiency_ScoreProduction_DateReport_DateDays_From_ReportNext_Service_DateProduct_Type_UpperProduct_Type_ProperProduct_KeyDefect_AdjustedUtilizationFraud_Flag
1L01electron12002.51.24508801JAN2024234073123407ELECTRONElectronL01_electron2.5GoodNO
2L02furnitur9503.82.45208203JAN2024234072923407FURNITURFurniturL02_furnitur3.8GoodNO
3L03electron15001.20.56109205JAN2024234072723407ELECTRONElectronL03_electron1.2ExcellentNO
4L04automoti18004.93.89007506JAN2024234072623407AUTOMOTIAutomotiL04_automoti4.9AverageNO
5L05textile7005.54.23007008JAN2024234072423407TEXTILETextileL05_textile5.5AverageNO
6L06electron16001.50.76509310JAN2024234072223407ELECTRONElectronL06_electron1.5ExcellentNO
7L07furnitur11002.91.54808511JAN2024234072123407FURNITURFurniturL07_furnitur2.9GoodNO
8L08automoti19006.15.09506813JAN2024234071923407AUTOMOTIAutomotiL08_automoti6.1PoorNO
9L09textile8004.23.03507414JAN2024234071823407TEXTILETextileL09_textile4.2AverageNO
10L10electron14002.01.05909016JAN2024234071623407ELECTRONElectronL10_electron2.0ExcellentNO
11L11furnitur10003.52.05008318JAN2024234071423407FURNITURFurniturL11_furnitur3.5GoodNO
12L12automoti20007.56.010006520JAN2024234071223407AUTOMOTIAutomotiL12_automoti7.5PoorYES
13L13textile7504.83.63307221JAN2024234071123407TEXTILETextileL13_textile4.8AverageNO
14L14electron17001.10.46809523JAN202423407923407ELECTRONElectronL14_electron1.1ExcellentNO
15L15automoti21008.27.011006025JAN202423407723407AUTOMOTIAutomotiL15_automoti8.2PoorYES

Detects:

·       Artificially inflated production

·       Manipulated defect logs

·       Fake efficiency metrics

Real-world use:

·       Internal audits

·       Compliance checks

·       Six Sigma reviews


STEP 6 — PROC SQL ANALYSIS

proc sql;

select Product_Type,

       avg(Units_Produced) as Avg_Units,

       avg(Defect_Rate) as Avg_Defect,

       avg(Efficiency_Score) as Avg_Efficiency

from factory_fraud

group by Product_Type;

quit;

OUTPUT:

Product_TypeAvg_UnitsAvg_DefectAvg_Efficiency
automoti19506.67567
electron14801.6691.6
furnitur1016.6673.483.33333
textile7504.83333372

Provides:

·       Management summary tables

·       Cross-product comparisons

Used for:

·       Board presentations

·       Manufacturing scorecards


STEP 7 — PROC FREQ

proc freq data=factory_fraud;

tables Product_Type*Utilization Fraud_Flag;

run;

OUTPUT:

The FREQ Procedure

Frequency
Percent
Row Pct
Col Pct
Table of Product_Type by Utilization
Product_TypeUtilization
AverageExcellentGoodPoorTotal
automoti
1
6.67
25.00
25.00
0
0.00
0.00
0.00
0
0.00
0.00
0.00
3
20.00
75.00
100.00
4
26.67
 
 
electron
0
0.00
0.00
0.00
4
26.67
80.00
100.00
1
6.67
20.00
25.00
0
0.00
0.00
0.00
5
33.33
 
 
furnitur
0
0.00
0.00
0.00
0
0.00
0.00
0.00
3
20.00
100.00
75.00
0
0.00
0.00
0.00
3
20.00
 
 
textile
3
20.00
100.00
75.00
0
0.00
0.00
0.00
0
0.00
0.00
0.00
0
0.00
0.00
0.00
3
20.00
 
 
Total
4
26.67
4
26.67
4
26.67
3
20.00
15
100.00
Fraud_FlagFrequencyPercentCumulative
Frequency
Cumulative
Percent
NO1386.671386.67
YES213.3315100.00

Shows:

·       Utilization distribution

·       Fraud frequency

Used in:

·       Risk reports

·       Control dashboards

STEP 8 — PROC MEANS & UNIVARIATE

proc means data=factory_fraud mean min max;

var Units_Produced Defect_Rate Downtime_Hours Energy_Consumption Efficiency_Score;

run;

OUTPUT:

The MEANS Procedure

VariableMeanMinimumMaximum
Units_Produced
Defect_Rate
Downtime_Hours
Energy_Consumption
Efficiency_Score
1366.67
3.9800000
2.8200000
627.3333333
79.4666667
700.0000000
1.1000000
0.4000000
300.0000000
60.0000000
2100.00
8.2000000
7.0000000
1100.00
95.0000000

proc univariate data=factory_fraud;

var Efficiency_Score;

histogram;

run;

OUTPUT:

The UNIVARIATE Procedure

Variable: Efficiency_Score

Moments
N15Sum Weights15
Mean79.4666667Sum Observations1192
Std Deviation11.1154119Variance123.552381
Skewness-0.1928899Kurtosis-1.2330588
Uncorrected SS96454Corrected SS1729.73333
Coeff Variation13.9875149Std Error Mean2.869987
Basic Statistical Measures
LocationVariability
Mean79.46667Std Deviation11.11541
Median82.00000Variance123.55238
Mode.Range35.00000
  Interquartile Range20.00000
Tests for Location: Mu0=0
TestStatisticp Value
Student's tt27.68886Pr > |t|<.0001
SignM7.5Pr >= |M|<.0001
Signed RankS60Pr >= |S|<.0001
Quantiles (Definition 5)
LevelQuantile
100% Max95
99%95
95%95
90%93
75% Q390
50% Median82
25% Q170
10%65
5%60
1%60
0% Min60
Extreme Observations
LowestHighest
ValueObsValueObs
6015881
65129010
688923
705936
72139514

The UNIVARIATE Procedure

Histogram for Efficiency_Score

Measures:

·       Central tendency

·       Outliers

·       Process stability

Used in:

·       SPC (Statistical Process Control)

·       Quality engineering

STEP 9 — CORRELATION

proc corr data=factory_fraud;

var Units_Produced Defect_Rate Downtime_Hours Energy_Consumption Efficiency_Score;

run;

OUTPUT:

The CORR Procedure

5 Variables:Units_Produced Defect_Rate Downtime_Hours Energy_Consumption Efficiency_Score
Simple Statistics
VariableNMeanStd DevSumMinimumMaximum
Units_Produced151367474.2161520500700.000002100
Defect_Rate153.980002.2084959.700001.100008.20000
Downtime_Hours152.820002.0719942.300000.400007.00000
Energy_Consumption15627.33333253.418539410300.000001100
Efficiency_Score1579.4666711.11541119260.0000095.00000
Pearson Correlation Coefficients, N = 15
Prob > |r| under H0: Rho=0
 Units_ProducedDefect_RateDowntime_HoursEnergy_ConsumptionEfficiency_Score
Units_Produced
1.00000
 
0.27417
0.3227
0.33367
0.2242
0.95763
<.0001
-0.16758
0.5505
Defect_Rate
0.27417
0.3227
1.00000
 
0.99442
<.0001
0.49202
0.0625
-0.98337
<.0001
Downtime_Hours
0.33367
0.2242
0.99442
<.0001
1.00000
 
0.53894
0.0382
-0.98079
<.0001
Energy_Consumption
0.95763
<.0001
0.49202
0.0625
0.53894
0.0382
1.00000
 
-0.38572
0.1556
Efficiency_Score
-0.16758
0.5505
-0.98337
<.0001
-0.98079
<.0001
-0.38572
0.1556
1.00000
 

Reveals:

·       Energy vs Efficiency

·       Downtime vs Defects

Used for:

·       Root cause analysis

·       Lean manufacturing

STEP 10 — VISUALIZATION

proc sgplot data=factory_fraud;

scatter x=Energy_Consumption y=Efficiency_Score;

run;

OUTPUT:

The SGPlot Procedure

Visual diagnostics:

·       Operational efficiency curve

·       Energy waste patterns


STEP 11 — TRANSPOSE

proc transpose data=factory_fraud out=factory_wide;

id Line_ID;

var Efficiency_Score;

run;

proc print data=factory_wide;

run;

OUTPUT:

Obs_NAME_L01L02L03L04L05L06L07L08L09L10L11L12L13L14L15
1Efficiency_Score888292757093856874908365729560

Used for:

·       Executive Excel reports

·       BI tools


STEP 12 — APPEND + MERGE

proc append base=factory_fraud 

            data=factory_lines force;

run;

proc print data=factory_fraud;

run;

OUTPUT:

ObsLine_IDProduct_TypeUnits_ProducedDefect_RateDowntime_HoursEnergy_ConsumptionEfficiency_ScoreProduction_DateReport_DateDays_From_ReportNext_Service_DateProduct_Type_UpperProduct_Type_ProperProduct_KeyDefect_AdjustedUtilizationFraud_Flag
1L01electron12002.51.24508801JAN2024234073123407ELECTRONElectronL01_electron2.5GoodNO
2L02furnitur9503.82.45208203JAN2024234072923407FURNITURFurniturL02_furnitur3.8GoodNO
3L03electron15001.20.56109205JAN2024234072723407ELECTRONElectronL03_electron1.2ExcellentNO
4L04automoti18004.93.89007506JAN2024234072623407AUTOMOTIAutomotiL04_automoti4.9AverageNO
5L05textile7005.54.23007008JAN2024234072423407TEXTILETextileL05_textile5.5AverageNO
6L06electron16001.50.76509310JAN2024234072223407ELECTRONElectronL06_electron1.5ExcellentNO
7L07furnitur11002.91.54808511JAN2024234072123407FURNITURFurniturL07_furnitur2.9GoodNO
8L08automoti19006.15.09506813JAN2024234071923407AUTOMOTIAutomotiL08_automoti6.1PoorNO
9L09textile8004.23.03507414JAN2024234071823407TEXTILETextileL09_textile4.2AverageNO
10L10electron14002.01.05909016JAN2024234071623407ELECTRONElectronL10_electron2.0ExcellentNO
11L11furnitur10003.52.05008318JAN2024234071423407FURNITURFurniturL11_furnitur3.5GoodNO
12L12automoti20007.56.010006520JAN2024234071223407AUTOMOTIAutomotiL12_automoti7.5PoorYES
13L13textile7504.83.63307221JAN2024234071123407TEXTILETextileL13_textile4.8AverageNO
14L14electron17001.10.46809523JAN202423407923407ELECTRONElectronL14_electron1.1ExcellentNO
15L15automoti21008.27.011006025JAN202423407723407AUTOMOTIAutomotiL15_automoti8.2PoorYES
16L01electron12002.51.24508801JAN2024...   .  
17L02furnitur9503.82.45208203JAN2024...   .  
18L03electron15001.20.56109205JAN2024...   .  
19L04automoti18004.93.89007506JAN2024...   .  
20L05textile7005.54.23007008JAN2024...   .  
21L06electron16001.50.76509310JAN2024...   .  
22L07furnitur11002.91.54808511JAN2024...   .  
23L08automoti19006.15.09506813JAN2024...   .  
24L09textile8004.23.03507414JAN2024...   .  
25L10electron14002.01.05909016JAN2024...   .  
26L11furnitur10003.52.05008318JAN2024...   .  
27L12automoti20007.56.010006520JAN2024...   .  
28L13textile7504.83.63307221JAN2024...   .  
29L14electron17001.10.46809523JAN2024...   .  
30L15automoti21008.27.011006025JAN2024...   .  

proc sort data=factory_fraud;

 by Line_ID;

run;

proc print data=factory_fraud;

run;

OUTPUT:

ObsLine_IDProduct_TypeUnits_ProducedDefect_RateDowntime_HoursEnergy_ConsumptionEfficiency_ScoreProduction_DateReport_DateDays_From_ReportNext_Service_DateProduct_Type_UpperProduct_Type_ProperProduct_KeyDefect_AdjustedUtilizationFraud_Flag
1L01electron12002.51.24508801JAN2024234073123407ELECTRONElectronL01_electron2.5GoodNO
2L01electron12002.51.24508801JAN2024...   .  
3L02furnitur9503.82.45208203JAN2024234072923407FURNITURFurniturL02_furnitur3.8GoodNO
4L02furnitur9503.82.45208203JAN2024...   .  
5L03electron15001.20.56109205JAN2024234072723407ELECTRONElectronL03_electron1.2ExcellentNO
6L03electron15001.20.56109205JAN2024...   .  
7L04automoti18004.93.89007506JAN2024234072623407AUTOMOTIAutomotiL04_automoti4.9AverageNO
8L04automoti18004.93.89007506JAN2024...   .  
9L05textile7005.54.23007008JAN2024234072423407TEXTILETextileL05_textile5.5AverageNO
10L05textile7005.54.23007008JAN2024...   .  
11L06electron16001.50.76509310JAN2024234072223407ELECTRONElectronL06_electron1.5ExcellentNO
12L06electron16001.50.76509310JAN2024...   .  
13L07furnitur11002.91.54808511JAN2024234072123407FURNITURFurniturL07_furnitur2.9GoodNO
14L07furnitur11002.91.54808511JAN2024...   .  
15L08automoti19006.15.09506813JAN2024234071923407AUTOMOTIAutomotiL08_automoti6.1PoorNO
16L08automoti19006.15.09506813JAN2024...   .  
17L09textile8004.23.03507414JAN2024234071823407TEXTILETextileL09_textile4.2AverageNO
18L09textile8004.23.03507414JAN2024...   .  
19L10electron14002.01.05909016JAN2024234071623407ELECTRONElectronL10_electron2.0ExcellentNO
20L10electron14002.01.05909016JAN2024...   .  
21L11furnitur10003.52.05008318JAN2024234071423407FURNITURFurniturL11_furnitur3.5GoodNO
22L11furnitur10003.52.05008318JAN2024...   .  
23L12automoti20007.56.010006520JAN2024234071223407AUTOMOTIAutomotiL12_automoti7.5PoorYES
24L12automoti20007.56.010006520JAN2024...   .  
25L13textile7504.83.63307221JAN2024234071123407TEXTILETextileL13_textile4.8AverageNO
26L13textile7504.83.63307221JAN2024...   .  
27L14electron17001.10.46809523JAN202423407923407ELECTRONElectronL14_electron1.1ExcellentNO
28L14electron17001.10.46809523JAN2024...   .  
29L15automoti21008.27.011006025JAN202423407723407AUTOMOTIAutomotiL15_automoti8.2PoorYES
30L15automoti21008.27.011006025JAN2024...   .  

proc sort data=factory_dates;

 by Line_ID;

run;

proc print data=factory_dates;

run;

OUTPUT:

ObsLine_IDProduct_TypeUnits_ProducedDefect_RateDowntime_HoursEnergy_ConsumptionEfficiency_ScoreProduction_DateReport_DateDays_From_ReportNext_Service_Date
1L01electron12002.51.24508801JAN2024234073123407
2L02furnitur9503.82.45208203JAN2024234072923407
3L03electron15001.20.56109205JAN2024234072723407
4L04automoti18004.93.89007506JAN2024234072623407
5L05textile7005.54.23007008JAN2024234072423407
6L06electron16001.50.76509310JAN2024234072223407
7L07furnitur11002.91.54808511JAN2024234072123407
8L08automoti19006.15.09506813JAN2024234071923407
9L09textile8004.23.03507414JAN2024234071823407
10L10electron14002.01.05909016JAN2024234071623407
11L11furnitur10003.52.05008318JAN2024234071423407
12L12automoti20007.56.010006520JAN2024234071223407
13L13textile7504.83.63307221JAN2024234071123407
14L14electron17001.10.46809523JAN202423407923407
15L15automoti21008.27.011006025JAN202423407723407

data merged_factory;

merge factory_fraud factory_dates;

by Line_ID;

run;

proc print data=merged_factory;

run;

OUTPUT:

ObsLine_IDProduct_TypeUnits_ProducedDefect_RateDowntime_HoursEnergy_ConsumptionEfficiency_ScoreProduction_DateReport_DateDays_From_ReportNext_Service_DateProduct_Type_UpperProduct_Type_ProperProduct_KeyDefect_AdjustedUtilizationFraud_Flag
1L01electron12002.51.24508801JAN2024234073123407ELECTRONElectronL01_electron2.5GoodNO
2L01electron12002.51.24508801JAN2024...   .  
3L02furnitur9503.82.45208203JAN2024234072923407FURNITURFurniturL02_furnitur3.8GoodNO
4L02furnitur9503.82.45208203JAN2024...   .  
5L03electron15001.20.56109205JAN2024234072723407ELECTRONElectronL03_electron1.2ExcellentNO
6L03electron15001.20.56109205JAN2024...   .  
7L04automoti18004.93.89007506JAN2024234072623407AUTOMOTIAutomotiL04_automoti4.9AverageNO
8L04automoti18004.93.89007506JAN2024...   .  
9L05textile7005.54.23007008JAN2024234072423407TEXTILETextileL05_textile5.5AverageNO
10L05textile7005.54.23007008JAN2024...   .  
11L06electron16001.50.76509310JAN2024234072223407ELECTRONElectronL06_electron1.5ExcellentNO
12L06electron16001.50.76509310JAN2024...   .  
13L07furnitur11002.91.54808511JAN2024234072123407FURNITURFurniturL07_furnitur2.9GoodNO
14L07furnitur11002.91.54808511JAN2024...   .  
15L08automoti19006.15.09506813JAN2024234071923407AUTOMOTIAutomotiL08_automoti6.1PoorNO
16L08automoti19006.15.09506813JAN2024...   .  
17L09textile8004.23.03507414JAN2024234071823407TEXTILETextileL09_textile4.2AverageNO
18L09textile8004.23.03507414JAN2024...   .  
19L10electron14002.01.05909016JAN2024234071623407ELECTRONElectronL10_electron2.0ExcellentNO
20L10electron14002.01.05909016JAN2024...   .  
21L11furnitur10003.52.05008318JAN2024234071423407FURNITURFurniturL11_furnitur3.5GoodNO
22L11furnitur10003.52.05008318JAN2024...   .  
23L12automoti20007.56.010006520JAN2024234071223407AUTOMOTIAutomotiL12_automoti7.5PoorYES
24L12automoti20007.56.010006520JAN2024...   .  
25L13textile7504.83.63307221JAN2024234071123407TEXTILETextileL13_textile4.8AverageNO
26L13textile7504.83.63307221JAN2024...   .  
27L14electron17001.10.46809523JAN202423407923407ELECTRONElectronL14_electron1.1ExcellentNO
28L14electron17001.10.46809523JAN2024...   .  
29L15automoti21008.27.011006025JAN202423407723407AUTOMOTIAutomotiL15_automoti8.2PoorYES
30L15automoti21008.27.011006025JAN2024...   .  

Enterprise data pipelines always:

·       Append daily feeds

·       Merge reference tables


STEP 13 — DELETE TEMP DATASETS

proc datasets lib=work;

delete factory_clean factory_dates factory_util;

quit;

LOG:

NOTE: Deleting WORK.FACTORY_CLEAN (memtype=DATA).
NOTE: Deleting WORK.FACTORY_DATES (memtype=DATA).
NOTE: Deleting WORK.FACTORY_UTIL (memtype=DATA).

Critical for:

·       Memory optimization

·       Production batch jobs


FINAL BUSINESS INSIGHTS

Insight

Meaning

High energy consumption reduces efficiency

Energy optimization required

Automotive lines have highest fraud risk

Audit required

Low downtime correlates with high output

Preventive maintenance working

High defect + high downtime = red flag

Process manipulation

 

CONCLUSION

This project demonstrates a complete industrial analytics lifecycle using SAS:

·       Data ingestion

·       Cleaning

·       Feature engineering

·       Statistical modeling

·       Fraud detection

·       Visualization

·       Business interpretation

It exactly mirrors what manufacturing companies, industrial IoT teams, and operations analytics roles expect from a SAS programmer or data analyst.



INTERVIEW QUESTIONS FOR YOU

1.How does FIRST.variable and LAST.variable work?

2.What is RETAIN and when is it used?

3.What is BY-group processing?


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 Manufacturing Industries 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.

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

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