372.CHEMICAL ELEMENTS ANALYSIS USING SAS
CHEMICAL ELEMENTS ANALYSIS USING SAS
1. Project Overview
Chemical elements form the foundation of
chemistry, materials science, pharmaceuticals, metallurgy, and electronics.
Each element has unique physical and chemical properties such as atomic number, atomic weight, melting
point, and industrial or medical
usage.
In this project, we create a custom chemical elements dataset and
analyze it using SAS programming techniques,
focusing on:
·
Data creation and structuring
·
Date handling and time intelligence
·
Statistical analysis
·
Classification using macros
·
Dataset transformation and reshaping
·
Real-world reporting readiness
This project is intentionally designed to simulate enterprise-level SAS work, not
just academic examples.
2. Dataset Design
2.1 Variables Included
|
Variable Name |
Description |
|
Element_Name |
Name of the chemical element |
|
Atomic_Number |
Number of protons |
|
Weight |
Atomic weight |
|
Melting_Point |
Melting point in °C |
|
Usage |
Primary industrial / scientific usage |
|
Discovery_Date |
Date the element was discovered |
3. Creating the Base Dataset (DATA Step)
data elements_raw;
length Element_Name $15 Usage $40;
format Discovery_Date date9.;
input Element_Name $ Atomic_Number Weight Melting_Point Usage $
Discovery_Date :date9.;
datalines;
Hydrogen 1 1.008 -259 Fuel 01JAN1766
Helium 2 4.0026 -272 Cryogenics 01JAN1895
Lithium 3 6.94 180 Batteries 01JAN1817
Carbon 6 12.011 3550 OrganicChem 01JAN0000
Nitrogen 7 14.007 -210 Fertilizers 01JAN1772
Oxygen 8 15.999 -218 MedicalUse 01JAN1774
Sodium 11 22.99 98 SaltProduction 01JAN1807
Magnesium 12 24.305 650 Alloys 01JAN1755
Aluminum 13 26.98 660 Construction 01JAN1825
Silicon 14 28.085 1414 Electronics 01JAN1824
Phosphorus 15 30.974 44 Agriculture 01JAN1669
Sulfur 16 32.06 115 Chemicals 01JAN1777
Chlorine 17 35.45 -101 WaterTreatment 01JAN1774
Iron 26 55.845 1538 Steel 01JAN0000
Copper 29 63.546 1085 Wiring 01JAN0000
Zinc 30 65.38 420 Galvanization 01JAN1746
Silver 47 107.8682 962 Jewelry 01JAN0000
Gold 79 196.97 1064 Investment 01JAN0000
;
run;
proc print data=elements_raw;
run;
OUTPUT:
| Obs | Element_Name | Usage | Discovery_Date | Atomic_Number | Weight | Melting_Point |
|---|---|---|---|---|---|---|
| 1 | Hydrogen | Fuel | 01JAN1766 | 1 | 1.008 | -259 |
| 2 | Helium | Cryogenics | 01JAN1895 | 2 | 4.003 | -272 |
| 3 | Lithium | Batteries | 01JAN1817 | 3 | 6.940 | 180 |
| 4 | Carbon | OrganicChem | 01JAN2000 | 6 | 12.011 | 3550 |
| 5 | Nitrogen | Fertilizers | 01JAN1772 | 7 | 14.007 | -210 |
| 6 | Oxygen | MedicalUse | 01JAN1774 | 8 | 15.999 | -218 |
| 7 | Sodium | SaltProduction | 01JAN1807 | 11 | 22.990 | 98 |
| 8 | Magnesium | Alloys | 01JAN1755 | 12 | 24.305 | 650 |
| 9 | Aluminum | Construction | 01JAN1825 | 13 | 26.980 | 660 |
| 10 | Silicon | Electronics | 01JAN1824 | 14 | 28.085 | 1414 |
| 11 | Phosphorus | Agriculture | 01JAN1669 | 15 | 30.974 | 44 |
| 12 | Sulfur | Chemicals | 01JAN1777 | 16 | 32.060 | 115 |
| 13 | Chlorine | WaterTreatment | 01JAN1774 | 17 | 35.450 | -101 |
| 14 | Iron | Steel | 01JAN2000 | 26 | 55.845 | 1538 |
| 15 | Copper | Wiring | 01JAN2000 | 29 | 63.546 | 1085 |
| 16 | Zinc | Galvanization | 01JAN1746 | 30 | 65.380 | 420 |
| 17 | Silver | Jewelry | 01JAN2000 | 47 | 107.868 | 962 |
| 18 | Gold | Investment | 01JAN2000 | 79 | 196.970 | 1064 |
Key Concepts Learned
·
Variable length control
·
Informats and formats
·
Date literal handling
·
Realistic domain data modeling
4. Date Intelligence and Derived Variables
4.1 Adding Study Dates Using MDY, INTNX, INTCK
data elements_dates;
set elements_raw;
Reference_Date = mdy(1,1,2025);
Years_Since_Discovery = intck('year', Discovery_Date, Reference_Date);
Next_Review_Date = intnx('year', Discovery_Date, 300, 'same');
format Reference_Date Next_Review_Date date9.;
run;
proc print data=elements_dates;
run;
OUTPUT:
| Obs | Element_Name | Usage | Discovery_Date | Atomic_Number | Weight | Melting_Point | Reference_Date | Years_Since_Discovery | Next_Review_Date |
|---|---|---|---|---|---|---|---|---|---|
| 1 | Hydrogen | Fuel | 01JAN1766 | 1 | 1.008 | -259 | 01JAN2025 | 259 | 01JAN2066 |
| 2 | Helium | Cryogenics | 01JAN1895 | 2 | 4.003 | -272 | 01JAN2025 | 130 | 01JAN2195 |
| 3 | Lithium | Batteries | 01JAN1817 | 3 | 6.940 | 180 | 01JAN2025 | 208 | 01JAN2117 |
| 4 | Carbon | OrganicChem | 01JAN2000 | 6 | 12.011 | 3550 | 01JAN2025 | 25 | 01JAN2300 |
| 5 | Nitrogen | Fertilizers | 01JAN1772 | 7 | 14.007 | -210 | 01JAN2025 | 253 | 01JAN2072 |
| 6 | Oxygen | MedicalUse | 01JAN1774 | 8 | 15.999 | -218 | 01JAN2025 | 251 | 01JAN2074 |
| 7 | Sodium | SaltProduction | 01JAN1807 | 11 | 22.990 | 98 | 01JAN2025 | 218 | 01JAN2107 |
| 8 | Magnesium | Alloys | 01JAN1755 | 12 | 24.305 | 650 | 01JAN2025 | 270 | 01JAN2055 |
| 9 | Aluminum | Construction | 01JAN1825 | 13 | 26.980 | 660 | 01JAN2025 | 200 | 01JAN2125 |
| 10 | Silicon | Electronics | 01JAN1824 | 14 | 28.085 | 1414 | 01JAN2025 | 201 | 01JAN2124 |
| 11 | Phosphorus | Agriculture | 01JAN1669 | 15 | 30.974 | 44 | 01JAN2025 | 356 | 01JAN1969 |
| 12 | Sulfur | Chemicals | 01JAN1777 | 16 | 32.060 | 115 | 01JAN2025 | 248 | 01JAN2077 |
| 13 | Chlorine | WaterTreatment | 01JAN1774 | 17 | 35.450 | -101 | 01JAN2025 | 251 | 01JAN2074 |
| 14 | Iron | Steel | 01JAN2000 | 26 | 55.845 | 1538 | 01JAN2025 | 25 | 01JAN2300 |
| 15 | Copper | Wiring | 01JAN2000 | 29 | 63.546 | 1085 | 01JAN2025 | 25 | 01JAN2300 |
| 16 | Zinc | Galvanization | 01JAN1746 | 30 | 65.380 | 420 | 01JAN2025 | 279 | 01JAN2046 |
| 17 | Silver | Jewelry | 01JAN2000 | 47 | 107.868 | 962 | 01JAN2025 | 25 | 01JAN2300 |
| 18 | Gold | Investment | 01JAN2000 | 79 | 196.970 | 1064 | 01JAN2025 | 25 | 01JAN2300 |
Explanation
·
MDY() constructs dates explicitly
·
INTCK() calculates elapsed time
·
INTNX() projects future dates
·
These functions are heavily tested in interviews
5. PROC SQL – Data Querying & Business Logic
5.1 Creating a Filtered Table
proc sql;
create table high_temp_elements as
select Element_Name,Atomic_Number,Melting_Point,Usage
from elements_dates
where Melting_Point > 1000;
quit;
proc print data=high_temp_elements;
run;
OUTPUT:
| Obs | Element_Name | Atomic_Number | Melting_Point | Usage |
|---|---|---|---|---|
| 1 | Carbon | 6 | 3550 | OrganicChem |
| 2 | Silicon | 14 | 1414 | Electronics |
| 3 | Iron | 26 | 1538 | Steel |
| 4 | Copper | 29 | 1085 | Wiring |
| 5 | Gold | 79 | 1064 | Investment |
What This Demonstrates
·
SQL-style filtering
·
Dataset creation
·
Conditional logic
·
Industry relevance (high-temperature materials)
6. Statistical Analysis
6.1 PROC MEANS
proc means data=elements_dates mean min max std;
var Weight Melting_Point Years_Since_Discovery;
run;
OUTPUT:
The MEANS Procedure
| Variable | Mean | Minimum | Maximum | Std Dev |
|---|---|---|---|---|
Weight Melting_Point Years_Since_Discovery | 41.3567111 595.5555556 180.5000000 | 1.0080000 -272.0000000 25.0000000 | 196.9700000 3550.00 356.0000000 | 47.0411336 944.0932296 108.6934437 |
Why PROC MEANS
Matters
·
Central tendency
·
Variability analysis
·
Mandatory for clinical & industrial analytics
6.2 PROC UNIVARIATE
proc univariate data=elements_dates;
var Melting_Point;
histogram Melting_Point;
run;
OUTPUT:
The UNIVARIATE Procedure
Variable: Melting_Point
| Moments | |||
|---|---|---|---|
| N | 18 | Sum Weights | 18 |
| Mean | 595.555556 | Sum Observations | 10720 |
| Std Deviation | 944.09323 | Variance | 891312.026 |
| Skewness | 1.91009777 | Kurtosis | 4.82690524 |
| Uncorrected SS | 21536660 | Corrected SS | 15152304.4 |
| Coeff Variation | 158.523117 | Std Error Mean | 222.524908 |
| Basic Statistical Measures | |||
|---|---|---|---|
| Location | Variability | ||
| Mean | 595.5556 | Std Deviation | 944.09323 |
| Median | 300.0000 | Variance | 891312 |
| Mode | . | Range | 3822 |
| Interquartile Range | 1165 | ||
| Tests for Location: Mu0=0 | ||||
|---|---|---|---|---|
| Test | Statistic | p Value | ||
| Student's t | t | 2.676355 | Pr > |t| | 0.0159 |
| Sign | M | 4 | Pr >= |M| | 0.0963 |
| Signed Rank | S | 52.5 | Pr >= |S| | 0.0208 |
| Quantiles (Definition 5) | |
|---|---|
| Level | Quantile |
| 100% Max | 3550 |
| 99% | 3550 |
| 95% | 3550 |
| 90% | 1538 |
| 75% Q3 | 1064 |
| 50% Median | 300 |
| 25% Q1 | -101 |
| 10% | -259 |
| 5% | -272 |
| 1% | -272 |
| 0% Min | -272 |
| Extreme Observations | |||
|---|---|---|---|
| Lowest | Highest | ||
| Value | Obs | Value | Obs |
| -272 | 2 | 1064 | 18 |
| -259 | 1 | 1085 | 15 |
| -218 | 6 | 1414 | 10 |
| -210 | 5 | 1538 | 14 |
| -101 | 13 | 3550 | 4 |
The UNIVARIATE Procedure
What This Adds
·
Distribution understanding
·
Outlier detection
·
Regulatory-grade statistics
7. Macro Programming – Classification Logic
7.1 Macro to Classify Elements by Melting Point
%macro classify_element;
data classified_elements;
set elements_dates;
if Melting_Point < 0 then Category = "Gas or Cryogenic";
else if Melting_Point < 500 then Category = "Low Melting";
else if Melting_Point < 1000 then Category = "Medium Melting";
else Category = "High Melting";
run;
proc print data=classified_elements;
run;
%mend;
%classify_element;
OUTPUT:
| Obs | Element_Name | Usage | Discovery_Date | Atomic_Number | Weight | Melting_Point | Reference_Date | Years_Since_Discovery | Next_Review_Date | Category |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Hydrogen | Fuel | 01JAN1766 | 1 | 1.008 | -259 | 01JAN2025 | 259 | 01JAN2066 | Gas or Cryogenic |
| 2 | Helium | Cryogenics | 01JAN1895 | 2 | 4.003 | -272 | 01JAN2025 | 130 | 01JAN2195 | Gas or Cryogenic |
| 3 | Lithium | Batteries | 01JAN1817 | 3 | 6.940 | 180 | 01JAN2025 | 208 | 01JAN2117 | Low Melting |
| 4 | Carbon | OrganicChem | 01JAN2000 | 6 | 12.011 | 3550 | 01JAN2025 | 25 | 01JAN2300 | High Melting |
| 5 | Nitrogen | Fertilizers | 01JAN1772 | 7 | 14.007 | -210 | 01JAN2025 | 253 | 01JAN2072 | Gas or Cryogenic |
| 6 | Oxygen | MedicalUse | 01JAN1774 | 8 | 15.999 | -218 | 01JAN2025 | 251 | 01JAN2074 | Gas or Cryogenic |
| 7 | Sodium | SaltProduction | 01JAN1807 | 11 | 22.990 | 98 | 01JAN2025 | 218 | 01JAN2107 | Low Melting |
| 8 | Magnesium | Alloys | 01JAN1755 | 12 | 24.305 | 650 | 01JAN2025 | 270 | 01JAN2055 | Medium Melting |
| 9 | Aluminum | Construction | 01JAN1825 | 13 | 26.980 | 660 | 01JAN2025 | 200 | 01JAN2125 | Medium Melting |
| 10 | Silicon | Electronics | 01JAN1824 | 14 | 28.085 | 1414 | 01JAN2025 | 201 | 01JAN2124 | High Melting |
| 11 | Phosphorus | Agriculture | 01JAN1669 | 15 | 30.974 | 44 | 01JAN2025 | 356 | 01JAN1969 | Low Melting |
| 12 | Sulfur | Chemicals | 01JAN1777 | 16 | 32.060 | 115 | 01JAN2025 | 248 | 01JAN2077 | Low Melting |
| 13 | Chlorine | WaterTreatment | 01JAN1774 | 17 | 35.450 | -101 | 01JAN2025 | 251 | 01JAN2074 | Gas or Cryogenic |
| 14 | Iron | Steel | 01JAN2000 | 26 | 55.845 | 1538 | 01JAN2025 | 25 | 01JAN2300 | High Melting |
| 15 | Copper | Wiring | 01JAN2000 | 29 | 63.546 | 1085 | 01JAN2025 | 25 | 01JAN2300 | High Melting |
| 16 | Zinc | Galvanization | 01JAN1746 | 30 | 65.380 | 420 | 01JAN2025 | 279 | 01JAN2046 | Low Melting |
| 17 | Silver | Jewelry | 01JAN2000 | 47 | 107.868 | 962 | 01JAN2025 | 25 | 01JAN2300 | Medium Melting |
| 18 | Gold | Investment | 01JAN2000 | 79 | 196.970 | 1064 | 01JAN2025 | 25 | 01JAN2300 | High Melting |
Why Macros Are Critical
·
Reusability
·
Automation
·
Interview favorite topic
·
Production efficiency
8. Dataset Combination Techniques
8.1 SET Statement
data combined_set;
set elements_raw
high_temp_elements;
run;
proc print data=combined_set;
run;
OUTPUT:
| Obs | Element_Name | Usage | Discovery_Date | Atomic_Number | Weight | Melting_Point |
|---|---|---|---|---|---|---|
| 1 | Hydrogen | Fuel | 01JAN1766 | 1 | 1.008 | -259 |
| 2 | Helium | Cryogenics | 01JAN1895 | 2 | 4.003 | -272 |
| 3 | Lithium | Batteries | 01JAN1817 | 3 | 6.940 | 180 |
| 4 | Carbon | OrganicChem | 01JAN2000 | 6 | 12.011 | 3550 |
| 5 | Nitrogen | Fertilizers | 01JAN1772 | 7 | 14.007 | -210 |
| 6 | Oxygen | MedicalUse | 01JAN1774 | 8 | 15.999 | -218 |
| 7 | Sodium | SaltProduction | 01JAN1807 | 11 | 22.990 | 98 |
| 8 | Magnesium | Alloys | 01JAN1755 | 12 | 24.305 | 650 |
| 9 | Aluminum | Construction | 01JAN1825 | 13 | 26.980 | 660 |
| 10 | Silicon | Electronics | 01JAN1824 | 14 | 28.085 | 1414 |
| 11 | Phosphorus | Agriculture | 01JAN1669 | 15 | 30.974 | 44 |
| 12 | Sulfur | Chemicals | 01JAN1777 | 16 | 32.060 | 115 |
| 13 | Chlorine | WaterTreatment | 01JAN1774 | 17 | 35.450 | -101 |
| 14 | Iron | Steel | 01JAN2000 | 26 | 55.845 | 1538 |
| 15 | Copper | Wiring | 01JAN2000 | 29 | 63.546 | 1085 |
| 16 | Zinc | Galvanization | 01JAN1746 | 30 | 65.380 | 420 |
| 17 | Silver | Jewelry | 01JAN2000 | 47 | 107.868 | 962 |
| 18 | Gold | Investment | 01JAN2000 | 79 | 196.970 | 1064 |
| 19 | Carbon | OrganicChem | . | 6 | . | 3550 |
| 20 | Silicon | Electronics | . | 14 | . | 1414 |
| 21 | Iron | Steel | . | 26 | . | 1538 |
| 22 | Copper | Wiring | . | 29 | . | 1085 |
| 23 | Gold | Investment | . | 79 | . | 1064 |
Interview Insight
Difference between SET and MERGE is a classic SAS interview question.
8.2 APPEND
proc append base=elements_raw
data=high_temp_elements force;
run;
proc print data=elements_raw;
run;
OUTPUT:
| Obs | Element_Name | Usage | Discovery_Date | Atomic_Number | Weight | Melting_Point |
|---|---|---|---|---|---|---|
| 1 | Hydrogen | Fuel | 01JAN1766 | 1 | 1.008 | -259 |
| 2 | Helium | Cryogenics | 01JAN1895 | 2 | 4.003 | -272 |
| 3 | Lithium | Batteries | 01JAN1817 | 3 | 6.940 | 180 |
| 4 | Carbon | OrganicChem | 01JAN2000 | 6 | 12.011 | 3550 |
| 5 | Nitrogen | Fertilizers | 01JAN1772 | 7 | 14.007 | -210 |
| 6 | Oxygen | MedicalUse | 01JAN1774 | 8 | 15.999 | -218 |
| 7 | Sodium | SaltProduction | 01JAN1807 | 11 | 22.990 | 98 |
| 8 | Magnesium | Alloys | 01JAN1755 | 12 | 24.305 | 650 |
| 9 | Aluminum | Construction | 01JAN1825 | 13 | 26.980 | 660 |
| 10 | Silicon | Electronics | 01JAN1824 | 14 | 28.085 | 1414 |
| 11 | Phosphorus | Agriculture | 01JAN1669 | 15 | 30.974 | 44 |
| 12 | Sulfur | Chemicals | 01JAN1777 | 16 | 32.060 | 115 |
| 13 | Chlorine | WaterTreatment | 01JAN1774 | 17 | 35.450 | -101 |
| 14 | Iron | Steel | 01JAN2000 | 26 | 55.845 | 1538 |
| 15 | Copper | Wiring | 01JAN2000 | 29 | 63.546 | 1085 |
| 16 | Zinc | Galvanization | 01JAN1746 | 30 | 65.380 | 420 |
| 17 | Silver | Jewelry | 01JAN2000 | 47 | 107.868 | 962 |
| 18 | Gold | Investment | 01JAN2000 | 79 | 196.970 | 1064 |
| 19 | Carbon | OrganicChem | . | 6 | . | 3550 |
| 20 | Silicon | Electronics | . | 14 | . | 1414 |
| 21 | Iron | Steel | . | 26 | . | 1538 |
| 22 | Copper | Wiring | . | 29 | . | 1085 |
| 23 | Gold | Investment | . | 79 | . | 1064 |
8.3 MERGE
proc sort data=elements_raw; by Element_Name; run;
proc print data=elements_raw;
run;
OUTPUT:
| Obs | Element_Name | Usage | Discovery_Date | Atomic_Number | Weight | Melting_Point |
|---|---|---|---|---|---|---|
| 1 | Aluminum | Construction | 01JAN1825 | 13 | 26.980 | 660 |
| 2 | Carbon | OrganicChem | 01JAN2000 | 6 | 12.011 | 3550 |
| 3 | Carbon | OrganicChem | . | 6 | . | 3550 |
| 4 | Chlorine | WaterTreatment | 01JAN1774 | 17 | 35.450 | -101 |
| 5 | Copper | Wiring | 01JAN2000 | 29 | 63.546 | 1085 |
| 6 | Copper | Wiring | . | 29 | . | 1085 |
| 7 | Gold | Investment | 01JAN2000 | 79 | 196.970 | 1064 |
| 8 | Gold | Investment | . | 79 | . | 1064 |
| 9 | Helium | Cryogenics | 01JAN1895 | 2 | 4.003 | -272 |
| 10 | Hydrogen | Fuel | 01JAN1766 | 1 | 1.008 | -259 |
| 11 | Iron | Steel | 01JAN2000 | 26 | 55.845 | 1538 |
| 12 | Iron | Steel | . | 26 | . | 1538 |
| 13 | Lithium | Batteries | 01JAN1817 | 3 | 6.940 | 180 |
| 14 | Magnesium | Alloys | 01JAN1755 | 12 | 24.305 | 650 |
| 15 | Nitrogen | Fertilizers | 01JAN1772 | 7 | 14.007 | -210 |
| 16 | Oxygen | MedicalUse | 01JAN1774 | 8 | 15.999 | -218 |
| 17 | Phosphorus | Agriculture | 01JAN1669 | 15 | 30.974 | 44 |
| 18 | Silicon | Electronics | 01JAN1824 | 14 | 28.085 | 1414 |
| 19 | Silicon | Electronics | . | 14 | . | 1414 |
| 20 | Silver | Jewelry | 01JAN2000 | 47 | 107.868 | 962 |
| 21 | Sodium | SaltProduction | 01JAN1807 | 11 | 22.990 | 98 |
| 22 | Sulfur | Chemicals | 01JAN1777 | 16 | 32.060 | 115 |
| 23 | Zinc | Galvanization | 01JAN1746 | 30 | 65.380 | 420 |
proc sort data=classified_elements; by Element_Name; run;
proc print data=classified_elements;
run;
OUTPUT:
| Obs | Element_Name | Usage | Discovery_Date | Atomic_Number | Weight | Melting_Point | Reference_Date | Years_Since_Discovery | Next_Review_Date | Category |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Aluminum | Construction | 01JAN1825 | 13 | 26.980 | 660 | 01JAN2025 | 200 | 01JAN2125 | Medium Melting |
| 2 | Carbon | OrganicChem | 01JAN2000 | 6 | 12.011 | 3550 | 01JAN2025 | 25 | 01JAN2300 | High Melting |
| 3 | Chlorine | WaterTreatment | 01JAN1774 | 17 | 35.450 | -101 | 01JAN2025 | 251 | 01JAN2074 | Gas or Cryogenic |
| 4 | Copper | Wiring | 01JAN2000 | 29 | 63.546 | 1085 | 01JAN2025 | 25 | 01JAN2300 | High Melting |
| 5 | Gold | Investment | 01JAN2000 | 79 | 196.970 | 1064 | 01JAN2025 | 25 | 01JAN2300 | High Melting |
| 6 | Helium | Cryogenics | 01JAN1895 | 2 | 4.003 | -272 | 01JAN2025 | 130 | 01JAN2195 | Gas or Cryogenic |
| 7 | Hydrogen | Fuel | 01JAN1766 | 1 | 1.008 | -259 | 01JAN2025 | 259 | 01JAN2066 | Gas or Cryogenic |
| 8 | Iron | Steel | 01JAN2000 | 26 | 55.845 | 1538 | 01JAN2025 | 25 | 01JAN2300 | High Melting |
| 9 | Lithium | Batteries | 01JAN1817 | 3 | 6.940 | 180 | 01JAN2025 | 208 | 01JAN2117 | Low Melting |
| 10 | Magnesium | Alloys | 01JAN1755 | 12 | 24.305 | 650 | 01JAN2025 | 270 | 01JAN2055 | Medium Melting |
| 11 | Nitrogen | Fertilizers | 01JAN1772 | 7 | 14.007 | -210 | 01JAN2025 | 253 | 01JAN2072 | Gas or Cryogenic |
| 12 | Oxygen | MedicalUse | 01JAN1774 | 8 | 15.999 | -218 | 01JAN2025 | 251 | 01JAN2074 | Gas or Cryogenic |
| 13 | Phosphorus | Agriculture | 01JAN1669 | 15 | 30.974 | 44 | 01JAN2025 | 356 | 01JAN1969 | Low Melting |
| 14 | Silicon | Electronics | 01JAN1824 | 14 | 28.085 | 1414 | 01JAN2025 | 201 | 01JAN2124 | High Melting |
| 15 | Silver | Jewelry | 01JAN2000 | 47 | 107.868 | 962 | 01JAN2025 | 25 | 01JAN2300 | Medium Melting |
| 16 | Sodium | SaltProduction | 01JAN1807 | 11 | 22.990 | 98 | 01JAN2025 | 218 | 01JAN2107 | Low Melting |
| 17 | Sulfur | Chemicals | 01JAN1777 | 16 | 32.060 | 115 | 01JAN2025 | 248 | 01JAN2077 | Low Melting |
| 18 | Zinc | Galvanization | 01JAN1746 | 30 | 65.380 | 420 | 01JAN2025 | 279 | 01JAN2046 | Low Melting |
data merged_elements;
merge elements_raw classified_elements;
by Element_Name;
run;
proc print data=merged_elements;
run;
OUTPUT:
| Obs | Element_Name | Usage | Discovery_Date | Atomic_Number | Weight | Melting_Point | Reference_Date | Years_Since_Discovery | Next_Review_Date | Category |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Aluminum | Construction | 01JAN1825 | 13 | 26.980 | 660 | 01JAN2025 | 200 | 01JAN2125 | Medium Melting |
| 2 | Carbon | OrganicChem | 01JAN2000 | 6 | 12.011 | 3550 | 01JAN2025 | 25 | 01JAN2300 | High Melting |
| 3 | Carbon | OrganicChem | . | 6 | . | 3550 | 01JAN2025 | 25 | 01JAN2300 | High Melting |
| 4 | Chlorine | WaterTreatment | 01JAN1774 | 17 | 35.450 | -101 | 01JAN2025 | 251 | 01JAN2074 | Gas or Cryogenic |
| 5 | Copper | Wiring | 01JAN2000 | 29 | 63.546 | 1085 | 01JAN2025 | 25 | 01JAN2300 | High Melting |
| 6 | Copper | Wiring | . | 29 | . | 1085 | 01JAN2025 | 25 | 01JAN2300 | High Melting |
| 7 | Gold | Investment | 01JAN2000 | 79 | 196.970 | 1064 | 01JAN2025 | 25 | 01JAN2300 | High Melting |
| 8 | Gold | Investment | . | 79 | . | 1064 | 01JAN2025 | 25 | 01JAN2300 | High Melting |
| 9 | Helium | Cryogenics | 01JAN1895 | 2 | 4.003 | -272 | 01JAN2025 | 130 | 01JAN2195 | Gas or Cryogenic |
| 10 | Hydrogen | Fuel | 01JAN1766 | 1 | 1.008 | -259 | 01JAN2025 | 259 | 01JAN2066 | Gas or Cryogenic |
| 11 | Iron | Steel | 01JAN2000 | 26 | 55.845 | 1538 | 01JAN2025 | 25 | 01JAN2300 | High Melting |
| 12 | Iron | Steel | . | 26 | . | 1538 | 01JAN2025 | 25 | 01JAN2300 | High Melting |
| 13 | Lithium | Batteries | 01JAN1817 | 3 | 6.940 | 180 | 01JAN2025 | 208 | 01JAN2117 | Low Melting |
| 14 | Magnesium | Alloys | 01JAN1755 | 12 | 24.305 | 650 | 01JAN2025 | 270 | 01JAN2055 | Medium Melting |
| 15 | Nitrogen | Fertilizers | 01JAN1772 | 7 | 14.007 | -210 | 01JAN2025 | 253 | 01JAN2072 | Gas or Cryogenic |
| 16 | Oxygen | MedicalUse | 01JAN1774 | 8 | 15.999 | -218 | 01JAN2025 | 251 | 01JAN2074 | Gas or Cryogenic |
| 17 | Phosphorus | Agriculture | 01JAN1669 | 15 | 30.974 | 44 | 01JAN2025 | 356 | 01JAN1969 | Low Melting |
| 18 | Silicon | Electronics | 01JAN1824 | 14 | 28.085 | 1414 | 01JAN2025 | 201 | 01JAN2124 | High Melting |
| 19 | Silicon | Electronics | . | 14 | . | 1414 | 01JAN2025 | 201 | 01JAN2124 | High Melting |
| 20 | Silver | Jewelry | 01JAN2000 | 47 | 107.868 | 962 | 01JAN2025 | 25 | 01JAN2300 | Medium Melting |
| 21 | Sodium | SaltProduction | 01JAN1807 | 11 | 22.990 | 98 | 01JAN2025 | 218 | 01JAN2107 | Low Melting |
| 22 | Sulfur | Chemicals | 01JAN1777 | 16 | 32.060 | 115 | 01JAN2025 | 248 | 01JAN2077 | Low Melting |
| 23 | Zinc | Galvanization | 01JAN1746 | 30 | 65.380 | 420 | 01JAN2025 | 279 | 01JAN2046 | Low Melting |
9. PROC TRANSPOSE – Reshaping Data
proc transpose data=elements_dates
out=elements_transposed;
by Element_Name NotSorted;
var Weight Melting_Point;
run;
proc print data=elements_transposed;
run;
OUTPUT:
| Obs | Element_Name | _NAME_ | COL1 |
|---|---|---|---|
| 1 | Hydrogen | Weight | 1.01 |
| 2 | Hydrogen | Melting_Point | -259.00 |
| 3 | Helium | Weight | 4.00 |
| 4 | Helium | Melting_Point | -272.00 |
| 5 | Lithium | Weight | 6.94 |
| 6 | Lithium | Melting_Point | 180.00 |
| 7 | Carbon | Weight | 12.01 |
| 8 | Carbon | Melting_Point | 3550.00 |
| 9 | Nitrogen | Weight | 14.01 |
| 10 | Nitrogen | Melting_Point | -210.00 |
| 11 | Oxygen | Weight | 16.00 |
| 12 | Oxygen | Melting_Point | -218.00 |
| 13 | Sodium | Weight | 22.99 |
| 14 | Sodium | Melting_Point | 98.00 |
| 15 | Magnesium | Weight | 24.31 |
| 16 | Magnesium | Melting_Point | 650.00 |
| 17 | Aluminum | Weight | 26.98 |
| 18 | Aluminum | Melting_Point | 660.00 |
| 19 | Silicon | Weight | 28.09 |
| 20 | Silicon | Melting_Point | 1414.00 |
| 21 | Phosphorus | Weight | 30.97 |
| 22 | Phosphorus | Melting_Point | 44.00 |
| 23 | Sulfur | Weight | 32.06 |
| 24 | Sulfur | Melting_Point | 115.00 |
| 25 | Chlorine | Weight | 35.45 |
| 26 | Chlorine | Melting_Point | -101.00 |
| 27 | Iron | Weight | 55.85 |
| 28 | Iron | Melting_Point | 1538.00 |
| 29 | Copper | Weight | 63.55 |
| 30 | Copper | Melting_Point | 1085.00 |
| 31 | Zinc | Weight | 65.38 |
| 32 | Zinc | Melting_Point | 420.00 |
| 33 | Silver | Weight | 107.87 |
| 34 | Silver | Melting_Point | 962.00 |
| 35 | Gold | Weight | 196.97 |
| 36 | Gold | Melting_Point | 1064.00 |
Why This Is Important
·
Reporting formats
·
TLF creation
·
SDTM / ADaM reshaping logic
10. Additional SAS Statements Used
|
Statement |
Purpose |
|
DATA |
Dataset
creation |
|
SET |
Row-wise
concatenation |
|
MERGE |
Column-wise
joining |
|
APPEND |
Efficient
dataset expansion |
|
FORMAT |
Presentation
control |
|
INPUT |
Structured
data reading |
|
WHERE |
Conditional
filtering |
|
11.Business
|
|
12. What You Learn From This Project
Technical Skills
·
Base SAS mastery
·
PROC SQL proficiency
·
Macro automation
·
Date intelligence
Analytical Thinking
·
Classification logic
·
Statistical interpretation
·
Real-world data modeling
Interview Readiness
·
End-to-end SAS workflow
·
Dataset transformation
·
Production-level coding standards
13. How This Helps Your Career
This project can be confidently used as:
·
Interview
explanation project
·
Portfolio
project
·
Blog or
tutorial content
·
Training demonstration
Especially valuable for roles like:
·
SAS Programmer
·
Clinical Data Analyst
·
Data Scientist (SAS track)
·
Statistical Programmer
14. Conclusion
This Chemical
Elements SAS Project demonstrates how raw scientific data can be
transformed into actionable insights
using professional SAS programming
practices.
It mirrors real enterprise workflows, covers most frequently tested SAS topics, and
proves your capability to handle complex
datasets with confidence.
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 chemical elements 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
Comments
Post a Comment