215.ANALYZING GLOBAL PSYCHOPATH PROFILES USING PROC SQL AND MACROS IN SAS WITH COMPREHENSIVE INSIGHTS INTO DEMOGRAPHICS, BEHAVIORAL PATTERNS, CRIMINAL TENDENCIES, RISK TRAITS, AND PSYCHOLOGICAL ASSESSMENTS FOR PREDICTIVE PROFILING AND TREATMENT EVALUATION

ANALYZING GLOBAL PSYCHOPATH PROFILES USING PROC SQL AND MACROS IN SAS WITH COMPREHENSIVE INSIGHTS INTO DEMOGRAPHICS, BEHAVIORAL PATTERNS, CRIMINAL TENDENCIES, RISK TRAITS, AND PSYCHOLOGICAL ASSESSMENTS FOR PREDICTIVE PROFILING AND TREATMENT EVALUATION

 /*A unique and fictional dataset on "Psychopath Profiles Worldwide"*/

STEP 1: DATA CREATION USING PROC SQL

/* Step 1: Create the structure for the Psychopath dataset */

proc sql;

    create table Psychopath_Profiles (

        Profile_ID num,

        Name char(25),

        Country char(20),

        Age num,

        Gender char(6),

        Crime_Type char(25),

        IQ num,

        Empathy_Score num,

        Aggression_Score num,

        Diagnosed_Condition char(30),

        Treatment_Status char(15)

    );

quit;

Log:

NOTE: Table WORK.PSYCHOPATH_PROFILES created, with 0 rows and 11 columns.

NOTE: PROCEDURE SQL used (Total process time):

      real time           0.29 seconds

      cpu time            0.09 seconds


STEP 2: MACRO TO INSERT OBSERVATIONS

%macro insert_psycho(id, name, country, age, gender, crime, iq, empathy, aggression, condition, treatment);

    proc sql;

        insert into Psychopath_Profiles

        values(&id, "&name", "&country", &age, "&gender", "&crime", &iq, &empathy, &aggression, "&condition", "&treatment");

    quit;

%mend;


 STEP 3: INSERTING 20+  OBSERVATIONS

%insert_psycho(1, John Kessler, USA, 34, Male, %str(Serial Arson), 120, 30, 95, %str(Antisocial Personality), Ongoing);

%insert_psycho(2, Maria Gomez, Mexico, 28, Female, %str(Contract Killing), 112, 25, 90, %str(Psychopathy), Completed);

%insert_psycho(3, Ivan Petrov, Russia, 41, Male, %str(Kidnapping), 128, 22, 85, %str(Sociopathy), None);

%insert_psycho(4, Lee Hwa, South Korea, 36, Male, %str(Cyber Manipulation), 140, 35, 70, %str(Narcissistic PD), Ongoing);

%insert_psycho(5, Akira Saito, Japan, 30, Male, %str(White Collar Fraud), 145, 40, 65, %str(Schizoid PD), None);

%insert_psycho(6, Asha Verma, India, 33, Female, %str(Poisoning), 125, 28, 88, %str(Antisocial Personality), Ongoing);

%insert_psycho(7, Thomas Muller, Germany, 45, Male, %str(Organized Theft), 135, 33, 80, %str(Borderline PD), Completed);

%insert_psycho(8, Sarah McNeil, UK, 27, Female, %str(Child Abuse), 118, 20, 92, %str(Psychopathy), Ongoing);

%insert_psycho(9, Leonardo Rossi, Italy, 39, Male, %str(Homicide), 130, 24, 94, %str(Antisocial Personality), None);

%insert_psycho(10, Pierre Dubois, France, 42, Male, %str(Stalking), 110, 50, 77, %str(Obsessive PD), Completed);

%insert_psycho(11, Layla Hassan, Egypt, 29, Female, %str(Honor Killing), 115, 38, 85, %str(Paranoid PD), Ongoing);

%insert_psycho(12, Ahmed Jalil, Saudi Arabia, 38, Male, %str(Terror Recruitment), 122, 26, 90, %str(Psychopathy), None);

%insert_psycho(13, Carlos Silva, Brazil, 35, Male, %str(Gang Killing), 118, 29, 89, %str(Sociopathy), None);

%insert_psycho(14, Noura Al-Sabah, UAE, 26, Female, %str(Poisoning), 132, 31, 91, %str(Antisocial Personality), Completed);

%insert_psycho(15, Kevin Chen, Singapore, 32, Male, %str(Financial Scam), 137, 45, 72, %str(Schizotypal PD), Ongoing);

%insert_psycho(16, Greta Olsen, Sweden, 40, Female, %str(Psychological Abuse), 134, 36, 79, %str(Narcissistic PD), Ongoing);

%insert_psycho(17, Andre Mendes, Portugal, 44, Male, %str(Domestic Violence), 121, 27, 86, %str(Sociopathy), Completed);

%insert_psycho(18, Tanya Singh, India, 37, Female, %str(Acid Attack), 124, 30, 90, %str(Psychopathy), Ongoing);

%insert_psycho(19, Kang Min-ho, South Korea, 31, Male, %str(Sexual Assault), 119, 23, 93, %str(Antisocial Personality), Ongoing);

%insert_psycho(20, Henry Scott, USA, 46, Male, %str(Serial Killing), 138, 15, 99, %str(Psychopathy), None);

proc print;run;

Output:

STEP 4: SQL ANALYSIS USING PROC SQL

1. Country-wise Count of Diagnosed Psychopaths

proc sql;

    title "Count of Psychopaths by Country";

    select Country, count(*) as Total_Profiles

    from Psychopath_Profiles

    group by Country

    order by Total_Profiles desc;

quit;

Output:

Count of Psychopaths by Country

Country Total_Profiles
South Korea 2
India 2
USA 2
Sweden 1
Italy 1
Singapore 1
Russia 1
Saudi Arabia 1
France 1
Japan 1
UAE 1
Portugal 1
Brazil 1
Egypt 1
Germany 1
Mexico 1
UK 1

2. Average IQ by Crime Type

proc sql;

    title "Average IQ by Crime Type";

    select Crime_Type, avg(IQ) as Avg_IQ

    from Psychopath_Profiles

    group by Crime_Type

    order by Avg_IQ desc;

quit;

Output:

Average IQ by Crime Type

Crime_Type Avg_IQ
White Collar Fraud 145
Cyber Manipulation 140
Serial Killing 138
Financial Scam 137
Organized Theft 135
Psychological Abuse 134
Homicide 130
Poisoning 128.5
Kidnapping 128
Acid Attack 124
Terror Recruitment 122
Domestic Violence 121
Serial Arson 120
Sexual Assault 119
Gang Killing 118
Child Abuse 118
Honor Killing 115
Contract Killing 112
Stalking 110

3. Top 5 Most Aggressive Psychopaths

proc sql outobs=5;

    title "Top 5 Aggressive Psychopaths";

    select Name, Country, Aggression_Score, Empathy_Score, Diagnosed_Condition

    from Psychopath_Profiles

    order by Aggression_Score desc;

quit;

Output:

Top 5 Aggressive Psychopaths

Name Country Aggression_Score Empathy_Score Diagnosed_Condition
Henry Scott USA 99 15 Psychopathy
John Kessler USA 95 30 Antisocial Personality
Leonardo Rossi Italy 94 24 Antisocial Personality
Kang Min-ho South Korea 93 23 Antisocial Personality
Sarah McNeil UK 92 20 Psychopathy

4. Treatment Completion Rate

proc sql;

    title "Treatment Completion Statistics";

    select Treatment_Status, count(*) as Count

    from Psychopath_Profiles

    group by Treatment_Status;

quit;

Output:

Treatment Completion Statistics

Treatment_Status Count
Completed 5
None 6
Ongoing 9

5. Empathy vs Aggression Scatter View

proc sql;

    title "Empathy vs Aggression Overview";

    select Name, IQ, Empathy_Score, Aggression_Score, Diagnosed_Condition

    from Psychopath_Profiles

    where Empathy_Score < 35 and Aggression_Score > 85

    order by Aggression_Score desc;

quit;

Output:

Empathy vs Aggression Overview

Name IQ Empathy_Score Aggression_Score Diagnosed_Condition
Henry Scott 138 15 99 Psychopathy
John Kessler 120 30 95 Antisocial Personality
Leonardo Rossi 130 24 94 Antisocial Personality
Kang Min-ho 119 23 93 Antisocial Personality
Sarah McNeil 118 20 92 Psychopathy
Noura Al-Sabah 132 31 91 Antisocial Personality
Ahmed Jalil 122 26 90 Psychopathy
Tanya Singh 124 30 90 Psychopathy
Maria Gomez 112 25 90 Psychopathy
Carlos Silva 118 29 89 Sociopathy
Asha Verma 125 28 88 Antisocial Personality
Andre Mendes 121 27 86 Sociopathy

6. Countries with Highest Average Aggression

proc sql;

    title "Countries with Highest Average Aggression Score";

    select Country, avg(Aggression_Score) as Avg_Aggression

    from Psychopath_Profiles

    group by Country

    order by Avg_Aggression desc;

quit;

Output:

Countries with Highest Average Aggression Score

Country Avg_Aggression
USA 97
Italy 94
UK 92
UAE 91
Saudi Arabia 90
Mexico 90
Brazil 89
India 89
Portugal 86
Russia 85
Egypt 85
South Korea 81.5
Germany 80
Sweden 79
France 77
Singapore 72
Japan 65

7. Gender-wise Distribution of Crime Types

proc sql;

    title "Crime Type by Gender";

    select Gender, Crime_Type, count(*) as Cases

    from Psychopath_Profiles

    group by Gender, Crime_Type

    order by Gender, Cases desc;

quit;

Output:

Crime Type by Gender

Gender Crime_Type Cases
Female Poisoning 2
Female Child Abuse 1
Female Contract Killing 1
Female Psychological Abuse 1
Female Acid Attack 1
Female Honor Killing 1
Male Serial Arson 1
Male Organized Theft 1
Male Kidnapping 1
Male Cyber Manipulation 1
Male Serial Killing 1
Male Homicide 1
Male Gang Killing 1
Male White Collar Fraud 1
Male Financial Scam 1
Male Terror Recruitment 1
Male Stalking 1
Male Domestic Violence 1
Male Sexual Assault 1

STEP 5: MACRO FOR CUSTOM FILTERING

%macro filter_psycho(condition, threshold);

    proc sql;

        title "Filtering Psychopaths by &condition over &threshold";

        select Name, Country, &condition

        from Psychopath_Profiles

        where &condition > &threshold

        order by &condition desc;

    quit;

%mend;


%filter_psycho(Aggression_Score, 90);

Output:

Filtering Psychopaths by Aggression_Score over 90

Name Country Aggression_Score
Henry Scott USA 99
John Kessler USA 95
Leonardo Rossi Italy 94
Kang Min-ho South Korea 93
Sarah McNeil UK 92
Noura Al-Sabah UAE 91

%filter_psycho(IQ, 130);

Output:

Filtering Psychopaths by IQ over 130

Name Country IQ
Akira Saito Japan 145
Lee Hwa South Korea 140
Henry Scott USA 138
Kevin Chen Singapore 137
Thomas Muller Germany 135
Greta Olsen Sweden 134
Noura Al-Sabah UAE 132

STEP 6: MACRO TO SUMMARIZE TRAIT AVERAGES BY GENDER

%macro trait_avg_by_gender(trait);

    proc sql;

        title "Average &trait by Gender";

        select Gender, avg(&trait) as Avg_&trait

        from Psychopath_Profiles

        group by Gender;

    quit;

%mend;


%trait_avg_by_gender(IQ);

Output:

Average IQ by Gender

Gender Avg_IQ
Female 122.8571
Male 127.9231

%trait_avg_by_gender(Empathy_Score);

Output:

Average Empathy_Score by Gender

Gender Avg_Empathy_Score
Female 29.71429
Male 30.69231

%trait_avg_by_gender(Aggression_Score);

Output:

Average Aggression_Score by Gender

Gender Avg_Aggression_Score
Female 87.85714
Male 84.23077

STEP 7: CREATE A NEW TABLE WITH RISK LEVELS

proc sql;

    create table Psychopath_Risk as

    select *,

        case

            when Aggression_Score > 95 then "Extreme"

            when Aggression_Score > 85 then "High"

            when Aggression_Score > 70 then "Moderate"

            else "Low"

        end as Risk_Level

    from Psychopath_Profiles;

quit;

proc print;run;

Output:

Obs Profile_ID Name Country Age Gender Crime_Type IQ Empathy_Score Aggression_Score Diagnosed_Condition Treatment_Status Risk_Level
1 1 John Kessler USA 34 Male Serial Arson 120 30 95 Antisocial Personality Ongoing High
2 2 Maria Gomez Mexico 28 Female Contract Killing 112 25 90 Psychopathy Completed High
3 3 Ivan Petrov Russia 41 Male Kidnapping 128 22 85 Sociopathy None Moderate
4 4 Lee Hwa South Korea 36 Male Cyber Manipulation 140 35 70 Narcissistic PD Ongoing Low
5 5 Akira Saito Japan 30 Male White Collar Fraud 145 40 65 Schizoid PD None Low
6 6 Asha Verma India 33 Female Poisoning 125 28 88 Antisocial Personality Ongoing High
7 7 Thomas Muller Germany 45 Male Organized Theft 135 33 80 Borderline PD Completed Moderate
8 8 Sarah McNeil UK 27 Female Child Abuse 118 20 92 Psychopathy Ongoing High
9 9 Leonardo Rossi Italy 39 Male Homicide 130 24 94 Antisocial Personality None High
10 10 Pierre Dubois France 42 Male Stalking 110 50 77 Obsessive PD Completed Moderate
11 11 Layla Hassan Egypt 29 Female Honor Killing 115 38 85 Paranoid PD Ongoing Moderate
12 12 Ahmed Jalil Saudi Arabia 38 Male Terror Recruitment 122 26 90 Psychopathy None High
13 13 Carlos Silva Brazil 35 Male Gang Killing 118 29 89 Sociopathy None High
14 14 Noura Al-Sabah UAE 26 Female Poisoning 132 31 91 Antisocial Personality Completed High
15 15 Kevin Chen Singapore 32 Male Financial Scam 137 45 72 Schizotypal PD Ongoing Moderate
16 16 Greta Olsen Sweden 40 Female Psychological Abuse 134 36 79 Narcissistic PD Ongoing Moderate
17 17 Andre Mendes Portugal 44 Male Domestic Violence 121 27 86 Sociopathy Completed High
18 18 Tanya Singh India 37 Female Acid Attack 124 30 90 Psychopathy Ongoing High
19 19 Kang Min-ho South Korea 31 Male Sexual Assault 119 23 93 Antisocial Personality Ongoing High
20 20 Henry Scott USA 46 Male Serial Killing 138 15 99 Psychopathy None Extreme

proc sql;

    title "Distribution of Psychopaths by Risk Level";

    select Risk_Level, count(*) as Total

    from Psychopath_Risk

    group by Risk_Level

    order by Total desc;

quit;

Output:

Distribution of Psychopaths by Risk Level

Risk_Level Total
High 11
Moderate 6
Low 2
Extreme 1





To Visit My Previous Sas Questions Datasets:Click Here
To Visit My Previous Home Energy Consumption Dataset:Click Here
To Visit My Previous Wildlife Migration Dataset:Click Here
To Visit My Previous Endangered Species Dataset:Click Here


--->PRACTICE AND COMMENT YOUR OUTPUT: 

--->PLEASE FOLLOW OUR BLOG FOR MORE UPDATES.

PLEASE FOLLOW OUR TELEGRAM CHANNEL CLICK HERE

PLEASE FOLLOW OUR FACEBOOK PAGE  CLICK HERE

PLEASE FOLLOW OUR INSTAGRAM PAGE CLICK HERE



Comments