243.COMPREHENSIVE TOXICOLOGICAL DATA ANALYSIS OF DIVERSE POISONS USING PROC PRINT | PROC SORT | PROC MEANS | PROC FREQ | PROC SQL | SAS MACROS | IN A CLINICAL AND PUBLIC HEALTH CONTEXT
COMPREHENSIVE TOXICOLOGICAL DATA ANALYSIS OF DIVERSE POISONS USING PROC PRINT | PROC SORT | PROC MEANS | PROC FREQ | PROC SQL | SAS MACROS | IN A CLINICAL AND PUBLIC HEALTH CONTEXT
/*Creating the dataset different types of poisons*/
Step 1: Creating the Dataset - Types of Poisons
options nocenter;
data poisons_dataset;
length Poison_ID $5 Name $25 Source $20 Type $15 Symptoms $50 Toxicity_Level $10 Antidote $30 Fatal_Dose_mg 8;
input Poison_ID $ Name $ Source $ Type $ Symptoms $ Toxicity_Level $ Antidote $ Fatal_Dose_mg;
datalines;
P001 Arsenic Mineral Inorganic Vomiting/Diarrhea High Dimercaprol 70
P002 Cyanide Industrial Inorganic Seizures/Coma Very_High Hydroxocobalamin 200
P003 Ricin Plant Protein-based Vomiting/Seizure Very_High No_known_cure 1
P004 Strychnine Plant Alkaloid Muscle_spasms High Activated_Charcoal 50
P005 Methanol Alcohol Organic Nausea/Blindness Medium Ethanol/Fomepizole 30000
P006 Mercury Metal Inorganic Tremors/Memory_loss High Chelation_Therapy 500
P007 Lead Metal Inorganic Anemia/Abdominal_Pain High EDTA 1000
P008 Belladonna Plant Alkaloid Dry_mouth/Hallucinations Medium Physostigmine 20
P009 CarbonMonoxide Air Gas Headache/Nausea Medium Oxygen_Therapy 1500
P010 Chloroform Industrial Halocarbon Dizziness/Unconsciousness Medium None 10000
P011 Nicotine Plant Alkaloid Vomiting/Seizures High Activated_Charcoal 60
P012 DDT Pesticide Organochlorine Tremors/Nausea Medium None 2500
P013 VX_NerveGas Chemical Nerve_Agent Convulsions/Paralysis Very_High Atropine 0.01
P014 Sarin Chemical Nerve_Agent Seizures/Resp_failure Very_High Atropine/2-PAM 0.05
P015 Amatoxin Mushroom Cyclic_peptide Liver_failure Very_High Silibinin 0.1
P016 Methamphetamine Synthetic Stimulant Anxiety/Seizure Medium Sedatives 100
P017 EthyleneGlycol Antifreeze Alcohol Nausea/Seizure Medium Fomepizole 10000
P018 Antimony Metal Inorganic Vomiting/Dizziness Medium Chelation 900
P019 Aconitine Plant Alkaloid Numbness/Arrhythmia High No_known_antidote 5
P020 Batrachotoxin Animal Neurotoxin Muscle_paralysis Very_High No_antidote 0.002
P021 Thallium Metal Inorganic Hair_loss/Neuropathy High Prussian_Blue 15
P022 Hemlock Plant Alkaloid Respiratory_failure High Activated_Charcoal 100
P023 Dioxin Industrial Organic Skin_lesions/Liver_damage Medium No_antidote 50
P024 Formaldehyde Industrial Aldehyde Throat_irritation/Nausea Medium Supportive_Therapy 5000
P025 SnakeVenom Animal Protein-based Paralysis/Death Very_High Antivenom 0.05
P026 BotulinumToxin Bacterial Neurotoxin Muscle_weakness/Paralysis Very_High Antitoxin 0.0001
;
run;
proc print;run;
Output:
| Obs | Poison_ID | Name | Source | Type | Symptoms | Toxicity_Level | Antidote | Fatal_Dose_mg |
|---|---|---|---|---|---|---|---|---|
| 1 | P001 | Arsenic | Mineral | Inorganic | Vomiting/Diarrhea | High | Dimercaprol | 70.00 |
| 2 | P002 | Cyanide | Industrial | Inorganic | Seizures/Coma | Very_High | Hydroxocobalamin | 200.00 |
| 3 | P003 | Ricin | Plant | Protein-based | Vomiting/Seizure | Very_High | No_known_cure | 1.00 |
| 4 | P004 | Strychnine | Plant | Alkaloid | Muscle_spasms | High | Activated_Charcoal | 50.00 |
| 5 | P005 | Methanol | Alcohol | Organic | Nausea/Blindness | Medium | Ethanol/Fomepizole | 30000.00 |
| 6 | P006 | Mercury | Metal | Inorganic | Tremors/Memory_loss | High | Chelation_Therapy | 500.00 |
| 7 | P007 | Lead | Metal | Inorganic | Anemia/Abdominal_Pain | High | EDTA | 1000.00 |
| 8 | P008 | Belladonna | Plant | Alkaloid | Dry_mouth/Hallucinations | Medium | Physostigmine | 20.00 |
| 9 | P009 | CarbonMonoxide | Air | Gas | Headache/Nausea | Medium | Oxygen_Therapy | 1500.00 |
| 10 | P010 | Chloroform | Industrial | Halocarbon | Dizziness/Unconsciousness | Medium | None | 10000.00 |
| 11 | P011 | Nicotine | Plant | Alkaloid | Vomiting/Seizures | High | Activated_Charcoal | 60.00 |
| 12 | P012 | DDT | Pesticide | Organochlorine | Tremors/Nausea | Medium | None | 2500.00 |
| 13 | P013 | VX_NerveGas | Chemical | Nerve_Agent | Convulsions/Paralysis | Very_High | Atropine | 0.01 |
| 14 | P014 | Sarin | Chemical | Nerve_Agent | Seizures/Resp_failure | Very_High | Atropine/2-PAM | 0.05 |
| 15 | P015 | Amatoxin | Mushroom | Cyclic_peptide | Liver_failure | Very_High | Silibinin | 0.10 |
| 16 | P016 | Methamphetamine | Synthetic | Stimulant | Anxiety/Seizure | Medium | Sedatives | 100.00 |
| 17 | P017 | EthyleneGlycol | Antifreeze | Alcohol | Nausea/Seizure | Medium | Fomepizole | 10000.00 |
| 18 | P018 | Antimony | Metal | Inorganic | Vomiting/Dizziness | Medium | Chelation | 900.00 |
| 19 | P019 | Aconitine | Plant | Alkaloid | Numbness/Arrhythmia | High | No_known_antidote | 5.00 |
| 20 | P020 | Batrachotoxin | Animal | Neurotoxin | Muscle_paralysis | Very_High | No_antidote | 0.00 |
| 21 | P021 | Thallium | Metal | Inorganic | Hair_loss/Neuropathy | High | Prussian_Blue | 15.00 |
| 22 | P022 | Hemlock | Plant | Alkaloid | Respiratory_failure | High | Activated_Charcoal | 100.00 |
| 23 | P023 | Dioxin | Industrial | Organic | Skin_lesions/Liver_damage | Medium | No_antidote | 50.00 |
| 24 | P024 | Formaldehyde | Industrial | Aldehyde | Throat_irritation/Nausea | Medium | Supportive_Therapy | 5000.00 |
| 25 | P025 | SnakeVenom | Animal | Protein-based | Paralysis/Death | Very_High | Antivenom | 0.05 |
| 26 | P026 | BotulinumToxin | Bacterial | Neurotoxin | Muscle_weakness/Paralysis | Very_High | Antitoxin | 0.00 |
Step 2: PROC PRINT - View Full Dataset
proc print data=poisons_dataset;
title "Full Poisons Dataset Overview";
run;
Output:
| Full Poisons Dataset Overview |
| Obs | Poison_ID | Name | Source | Type | Symptoms | Toxicity_Level | Antidote | Fatal_Dose_mg |
|---|---|---|---|---|---|---|---|---|
| 1 | P001 | Arsenic | Mineral | Inorganic | Vomiting/Diarrhea | High | Dimercaprol | 70.00 |
| 2 | P002 | Cyanide | Industrial | Inorganic | Seizures/Coma | Very_High | Hydroxocobalamin | 200.00 |
| 3 | P003 | Ricin | Plant | Protein-based | Vomiting/Seizure | Very_High | No_known_cure | 1.00 |
| 4 | P004 | Strychnine | Plant | Alkaloid | Muscle_spasms | High | Activated_Charcoal | 50.00 |
| 5 | P005 | Methanol | Alcohol | Organic | Nausea/Blindness | Medium | Ethanol/Fomepizole | 30000.00 |
| 6 | P006 | Mercury | Metal | Inorganic | Tremors/Memory_loss | High | Chelation_Therapy | 500.00 |
| 7 | P007 | Lead | Metal | Inorganic | Anemia/Abdominal_Pain | High | EDTA | 1000.00 |
| 8 | P008 | Belladonna | Plant | Alkaloid | Dry_mouth/Hallucinations | Medium | Physostigmine | 20.00 |
| 9 | P009 | CarbonMonoxide | Air | Gas | Headache/Nausea | Medium | Oxygen_Therapy | 1500.00 |
| 10 | P010 | Chloroform | Industrial | Halocarbon | Dizziness/Unconsciousness | Medium | None | 10000.00 |
| 11 | P011 | Nicotine | Plant | Alkaloid | Vomiting/Seizures | High | Activated_Charcoal | 60.00 |
| 12 | P012 | DDT | Pesticide | Organochlorine | Tremors/Nausea | Medium | None | 2500.00 |
| 13 | P013 | VX_NerveGas | Chemical | Nerve_Agent | Convulsions/Paralysis | Very_High | Atropine | 0.01 |
| 14 | P014 | Sarin | Chemical | Nerve_Agent | Seizures/Resp_failure | Very_High | Atropine/2-PAM | 0.05 |
| 15 | P015 | Amatoxin | Mushroom | Cyclic_peptide | Liver_failure | Very_High | Silibinin | 0.10 |
| 16 | P016 | Methamphetamine | Synthetic | Stimulant | Anxiety/Seizure | Medium | Sedatives | 100.00 |
| 17 | P017 | EthyleneGlycol | Antifreeze | Alcohol | Nausea/Seizure | Medium | Fomepizole | 10000.00 |
| 18 | P018 | Antimony | Metal | Inorganic | Vomiting/Dizziness | Medium | Chelation | 900.00 |
| 19 | P019 | Aconitine | Plant | Alkaloid | Numbness/Arrhythmia | High | No_known_antidote | 5.00 |
| 20 | P020 | Batrachotoxin | Animal | Neurotoxin | Muscle_paralysis | Very_High | No_antidote | 0.00 |
| 21 | P021 | Thallium | Metal | Inorganic | Hair_loss/Neuropathy | High | Prussian_Blue | 15.00 |
| 22 | P022 | Hemlock | Plant | Alkaloid | Respiratory_failure | High | Activated_Charcoal | 100.00 |
| 23 | P023 | Dioxin | Industrial | Organic | Skin_lesions/Liver_damage | Medium | No_antidote | 50.00 |
| 24 | P024 | Formaldehyde | Industrial | Aldehyde | Throat_irritation/Nausea | Medium | Supportive_Therapy | 5000.00 |
| 25 | P025 | SnakeVenom | Animal | Protein-based | Paralysis/Death | Very_High | Antivenom | 0.05 |
| 26 | P026 | BotulinumToxin | Bacterial | Neurotoxin | Muscle_weakness/Paralysis | Very_High | Antitoxin | 0.00 |
Step 3: PROC SORT - Sorting by Fatal Dose
proc sort data=poisons_dataset out=sorted_poison;
by Fatal_Dose_mg;
run;
proc print data=sorted_poison;
title "Poisons Sorted by Increasing Fatal Dose (mg)";
run;
Output:
| Poisons Sorted by Increasing Fatal Dose (mg) |
| Obs | Poison_ID | Name | Source | Type | Symptoms | Toxicity_Level | Antidote | Fatal_Dose_mg |
|---|---|---|---|---|---|---|---|---|
| 1 | P026 | BotulinumToxin | Bacterial | Neurotoxin | Muscle_weakness/Paralysis | Very_High | Antitoxin | 0.00 |
| 2 | P020 | Batrachotoxin | Animal | Neurotoxin | Muscle_paralysis | Very_High | No_antidote | 0.00 |
| 3 | P013 | VX_NerveGas | Chemical | Nerve_Agent | Convulsions/Paralysis | Very_High | Atropine | 0.01 |
| 4 | P014 | Sarin | Chemical | Nerve_Agent | Seizures/Resp_failure | Very_High | Atropine/2-PAM | 0.05 |
| 5 | P025 | SnakeVenom | Animal | Protein-based | Paralysis/Death | Very_High | Antivenom | 0.05 |
| 6 | P015 | Amatoxin | Mushroom | Cyclic_peptide | Liver_failure | Very_High | Silibinin | 0.10 |
| 7 | P003 | Ricin | Plant | Protein-based | Vomiting/Seizure | Very_High | No_known_cure | 1.00 |
| 8 | P019 | Aconitine | Plant | Alkaloid | Numbness/Arrhythmia | High | No_known_antidote | 5.00 |
| 9 | P021 | Thallium | Metal | Inorganic | Hair_loss/Neuropathy | High | Prussian_Blue | 15.00 |
| 10 | P008 | Belladonna | Plant | Alkaloid | Dry_mouth/Hallucinations | Medium | Physostigmine | 20.00 |
| 11 | P004 | Strychnine | Plant | Alkaloid | Muscle_spasms | High | Activated_Charcoal | 50.00 |
| 12 | P023 | Dioxin | Industrial | Organic | Skin_lesions/Liver_damage | Medium | No_antidote | 50.00 |
| 13 | P011 | Nicotine | Plant | Alkaloid | Vomiting/Seizures | High | Activated_Charcoal | 60.00 |
| 14 | P001 | Arsenic | Mineral | Inorganic | Vomiting/Diarrhea | High | Dimercaprol | 70.00 |
| 15 | P016 | Methamphetamine | Synthetic | Stimulant | Anxiety/Seizure | Medium | Sedatives | 100.00 |
| 16 | P022 | Hemlock | Plant | Alkaloid | Respiratory_failure | High | Activated_Charcoal | 100.00 |
| 17 | P002 | Cyanide | Industrial | Inorganic | Seizures/Coma | Very_High | Hydroxocobalamin | 200.00 |
| 18 | P006 | Mercury | Metal | Inorganic | Tremors/Memory_loss | High | Chelation_Therapy | 500.00 |
| 19 | P018 | Antimony | Metal | Inorganic | Vomiting/Dizziness | Medium | Chelation | 900.00 |
| 20 | P007 | Lead | Metal | Inorganic | Anemia/Abdominal_Pain | High | EDTA | 1000.00 |
| 21 | P009 | CarbonMonoxide | Air | Gas | Headache/Nausea | Medium | Oxygen_Therapy | 1500.00 |
| 22 | P012 | DDT | Pesticide | Organochlorine | Tremors/Nausea | Medium | None | 2500.00 |
| 23 | P024 | Formaldehyde | Industrial | Aldehyde | Throat_irritation/Nausea | Medium | Supportive_Therapy | 5000.00 |
| 24 | P010 | Chloroform | Industrial | Halocarbon | Dizziness/Unconsciousness | Medium | None | 10000.00 |
| 25 | P017 | EthyleneGlycol | Antifreeze | Alcohol | Nausea/Seizure | Medium | Fomepizole | 10000.00 |
| 26 | P005 | Methanol | Alcohol | Organic | Nausea/Blindness | Medium | Ethanol/Fomepizole | 30000.00 |
Step 4: PROC MEANS - Fatal Dose Statistics
proc means data=poisons_dataset min max mean median;
var Fatal_Dose_mg;
title "Summary Statistics of Fatal Dose (mg)";
run;
Output:
| Summary Statistics of Fatal Dose (mg) |
| Analysis Variable : Fatal_Dose_mg | |||
|---|---|---|---|
| Minimum | Maximum | Mean | Median |
| 0.000100000 | 30000.00 | 2387.35 | 65.0000000 |
Step 5: PROC FREQ - Frequency of Poison Types
proc freq data=poisons_dataset;
tables Type Source Toxicity_Level / nocum nopercent;
title "Frequency Distribution of Poison Types, Sources, and Toxicity";
run;
Output:
| Frequency Distribution of Poison Types, Sources, and Toxicity |
| Type | Frequency |
|---|---|
| Alcohol | 1 |
| Aldehyde | 1 |
| Alkaloid | 5 |
| Cyclic_peptide | 1 |
| Gas | 1 |
| Halocarbon | 1 |
| Inorganic | 6 |
| Nerve_Agent | 2 |
| Neurotoxin | 2 |
| Organic | 2 |
| Organochlorine | 1 |
| Protein-based | 2 |
| Stimulant | 1 |
| Source | Frequency |
|---|---|
| Air | 1 |
| Alcohol | 1 |
| Animal | 2 |
| Antifreeze | 1 |
| Bacterial | 1 |
| Chemical | 2 |
| Industrial | 4 |
| Metal | 4 |
| Mineral | 1 |
| Mushroom | 1 |
| Pesticide | 1 |
| Plant | 6 |
| Synthetic | 1 |
| Toxicity_Level | Frequency |
|---|---|
| High | 8 |
| Medium | 10 |
| Very_High | 8 |
Step 6: PROC SQL - Key Insights Using Queries
a)Poisons with Fatal Dose < 10 mg
proc sql;
select Name, Fatal_Dose_mg, Toxicity_Level
from poisons_dataset
where Fatal_Dose_mg < 10;
quit;
Output:
| Name | Fatal_Dose_mg | Toxicity_Level |
|---|---|---|
| Ricin | 1 | Very_High |
| VX_NerveGas | 0.01 | Very_High |
| Sarin | 0.05 | Very_High |
| Amatoxin | 0.1 | Very_High |
| Aconitine | 5 | High |
| Batrachotoxin | 0.002 | Very_High |
| SnakeVenom | 0.05 | Very_High |
| BotulinumToxin | 0.0001 | Very_High |
b)Count of Each Type
proc sql;
select Type, count(*) as Count
from poisons_dataset
group by Type;
quit;
Output:
| Type | Count |
|---|---|
| Alcohol | 1 |
| Aldehyde | 1 |
| Alkaloid | 5 |
| Cyclic_peptide | 1 |
| Gas | 1 |
| Halocarbon | 1 |
| Inorganic | 6 |
| Nerve_Agent | 2 |
| Neurotoxin | 2 |
| Organic | 2 |
| Organochlorine | 1 |
| Protein-based | 2 |
| Stimulant | 1 |
c)Top 5 Most Toxic Poisons
proc sql outobs=5;
select Name, Fatal_Dose_mg, Toxicity_Level
from poisons_dataset
order by Fatal_Dose_mg;
quit;
Output:
| Name | Fatal_Dose_mg | Toxicity_Level |
|---|---|---|
| BotulinumToxin | 0.0001 | Very_High |
| Batrachotoxin | 0.002 | Very_High |
| VX_NerveGas | 0.01 | Very_High |
| SnakeVenom | 0.05 | Very_High |
| Sarin | 0.05 | Very_High |
Step 7: MACRO for Filtering Poisons by Source
%macro filter_by_source(source_type);
proc sql;
title "Poisons from Source: &source_type";
select Poison_ID, Name, Type, Fatal_Dose_mg
from poisons_dataset
where Source = "&source_type";
quit;
%mend filter_by_source;
%filter_by_source(Plant);
Output:
| Poisons from Source: Plant |
| Poison_ID | Name | Type | Fatal_Dose_mg |
|---|---|---|---|
| P003 | Ricin | Protein-based | 1 |
| P004 | Strychnine | Alkaloid | 50 |
| P008 | Belladonna | Alkaloid | 20 |
| P011 | Nicotine | Alkaloid | 60 |
| P019 | Aconitine | Alkaloid | 5 |
| P022 | Hemlock | Alkaloid | 100 |
%filter_by_source(Metal);
Output:
| Poisons from Source: Metal |
| Poison_ID | Name | Type | Fatal_Dose_mg |
|---|---|---|---|
| P006 | Mercury | Inorganic | 500 |
| P007 | Lead | Inorganic | 1000 |
| P018 | Antimony | Inorganic | 900 |
| P021 | Thallium | Inorganic | 15 |
%filter_by_source(Industrial);
Output:
| Poisons from Source: Industrial |
| Poison_ID | Name | Type | Fatal_Dose_mg |
|---|---|---|---|
| P002 | Cyanide | Inorganic | 200 |
| P010 | Chloroform | Halocarbon | 10000 |
| P023 | Dioxin | Organic | 50 |
| P024 | Formaldehyde | Aldehyde | 5000 |
Step 8: MACRO for Toxicity Summary
%macro toxicity_summary(tox_level);
proc sql;
title "Poisons with Toxicity Level: &tox_level";
select Name, Type, Source, Fatal_Dose_mg
from poisons_dataset
where Toxicity_Level = "&tox_level";
quit;
%mend toxicity_summary;
%toxicity_summary(High);
Output:
| Poisons with Toxicity Level: High |
| Name | Type | Source | Fatal_Dose_mg |
|---|---|---|---|
| Arsenic | Inorganic | Mineral | 70 |
| Strychnine | Alkaloid | Plant | 50 |
| Mercury | Inorganic | Metal | 500 |
| Lead | Inorganic | Metal | 1000 |
| Nicotine | Alkaloid | Plant | 60 |
| Aconitine | Alkaloid | Plant | 5 |
| Thallium | Inorganic | Metal | 15 |
| Hemlock | Alkaloid | Plant | 100 |
%toxicity_summary(Very_High);
Output:
| Poisons with Toxicity Level: Very_High |
| Name | Type | Source | Fatal_Dose_mg |
|---|---|---|---|
| Cyanide | Inorganic | Industrial | 200 |
| Ricin | Protein-based | Plant | 1 |
| VX_NerveGas | Nerve_Agent | Chemical | 0.01 |
| Sarin | Nerve_Agent | Chemical | 0.05 |
| Amatoxin | Cyclic_peptide | Mushroom | 0.1 |
| Batrachotoxin | Neurotoxin | Animal | 0.002 |
| SnakeVenom | Protein-based | Animal | 0.05 |
| BotulinumToxin | Neurotoxin | Bacterial | 0.0001 |
Step 9: Special Queries for Research Insights
a)Poisons with No Antidote
proc sql;
select Name, Source, Type, Toxicity_Level
from poisons_dataset
where Antidote contains 'No';
quit;
Output:
| Name | Source | Type | Toxicity_Level |
|---|---|---|---|
| Ricin | Plant | Protein-based | Very_High |
| Chloroform | Industrial | Halocarbon | Medium |
| DDT | Pesticide | Organochlorine | Medium |
| Aconitine | Plant | Alkaloid | High |
| Batrachotoxin | Animal | Neurotoxin | Very_High |
| Dioxin | Industrial | Organic | Medium |
b)Top 3 Deadliest Poisons from Plants
proc sql outobs=3;
select Name, Fatal_Dose_mg
from poisons_dataset
where Source='Plant'
order by Fatal_Dose_mg;
quit;
Output:
| Name | Fatal_Dose_mg |
|---|---|
| Ricin | 1 |
| Aconitine | 5 |
| Belladonna | 20 |
Step 10: Exporting to External CSV
proc export data=poisons_dataset
outfile="poisons_analysis.csv"
dbms=csv
replace;
run;
Log:
NOTE: The file 'poisons_analysis.csv' is:
Filename=C:\sas folder\SASFoundation\9.4\poisons_analysis.csv,
RECFM=V,LRECL=32767,File Size (bytes)=0,
Last Modified=17 July 2025 19:20:47,
Create Time=17 July 2025 19:20:47
NOTE: 27 records were written to the file 'poisons_analysis.csv'.
The minimum record length was 62.
The maximum record length was 93.
NOTE: There were 26 observations read from the data set WORK.POISONS_DATASET.
NOTE: DATA statement used (Total process time):
real time 0.18 seconds
cpu time 0.06 seconds
26 records created in poisons_analysis.csv from POISONS_DATASET.
NOTE: "poisons_analysis.csv" file was successfully created.
NOTE: PROCEDURE EXPORT used (Total process time):
real time 2.26 seconds
cpu time 0.28 seconds
Comments
Post a Comment