220.ANALYZING GLOBAL MONEY LOAN TRENDS USING PROC CONTENTS | PROC PRINT | PROC MEANS | PROC FREQ | PROC SQL | PROC FORMAT | PROC REPORT | MACROS | OPTIONS | AND FUNCTIONS IN SAS
- Get link
- X
- Other Apps
ANALYZING GLOBAL MONEY LOAN TRENDS USING PROC CONTENTS | PROC PRINT | PROC MEANS | PROC FREQ | PROC SQL | PROC FORMAT | PROC REPORT | MACROS | OPTIONS | AND FUNCTIONS IN SAS
/*Creating a Money Loan Dataset with worldwide observations*/
Step 1: Setting Options and Creating the Loan Dataset
options nodate nonumber ls=120 ps=60 formdlim='*' msglevel=i;
%let today = %sysfunc(today(), date9.);
data money_loans;
infile datalines dlm=',' dsd;
length Loan_ID $8 Borrower_Name $25 Country $15 Currency $10 Loan_Type $15 Gender $6;
input Loan_ID $ Borrower_Name $ Country $ Currency $ Loan_Amount Interest_Rate Loan_Term_Months Start_Date :date9. Loan_Type $ Gender $ Credit_Score Monthly_Income;
format Loan_Amount dollar12.2 Interest_Rate percent8.2 Start_Date date9.;
datalines;
L001,John Smith,USA,USD,50000,0.075,60,01JAN2021,Personal,Male,720,4000
L002,Ana Gomez,Mexico,MXN,300000,0.082,48,15FEB2022,Home,Female,680,3500
L003,Ravi Kumar,India,INR,700000,0.095,36,01MAR2021,Education,Male,650,25000
L004,Linda Chen,China,CNY,80000,0.07,24,20APR2023,Auto,Female,710,18000
L005,David Brown,UK,GBP,25000,0.065,12,05MAY2020,Business,Male,750,3000
L006,Noura Al-Fahad,UAE,AED,120000,0.06,36,10JUN2021,Personal,Female,730,20000
L007,Igor Petrov,Russia,RUB,500000,0.1,48,12JUL2022,Home,Male,660,30000
L008,Mei Tan,Singapore,SGD,15000,0.055,24,23AUG2021,Education,Female,770,5000
L009,Jose Silva,Brazil,BRL,40000,0.11,30,01SEP2020,Auto,Male,640,6000
L010,Maria Rossi,Italy,EUR,35000,0.068,60,14OCT2022,Business,Female,720,3500
L011,Tom Lee,South Korea,KRW,30000000,0.092,48,05NOV2021,Home,Male,700,4200000
L012,Fatima Zahra,Morocco,MAD,100000,0.085,36,22DEC2021,Personal,Female,710,12000
L013,Juan Carlos,Spain,EUR,28000,0.07,24,07JAN2023,Auto,Male,690,2800
L014,Emily Davis,Canada,CAD,22000,0.062,48,19FEB2022,Education,Female,760,4100
L015,Yuki Nakamura,Japan,JPY,2500000,0.058,60,11MAR2020,Business,Female,740,520000
L016,Ahmed Said,Egypt,EGP,150000,0.102,30,20APR2023,Home,Male,670,9000
;
run;
proc print;run;
Output:
Obs | Loan_ID | Borrower_Name | Country | Currency | Loan_Type | Gender | Loan_Amount | Interest_Rate | Loan_Term_Months | Start_Date | Credit_Score | Monthly_Income |
---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | L001 | John Smith | USA | USD | Personal | Male | $50,000.00 | 7.50% | 60 | 01JAN2021 | 720 | 4000 |
2 | L002 | Ana Gomez | Mexico | MXN | Home | Female | $300,000.00 | 8.20% | 48 | 15FEB2022 | 680 | 3500 |
3 | L003 | Ravi Kumar | India | INR | Education | Male | $700,000.00 | 9.50% | 36 | 01MAR2021 | 650 | 25000 |
4 | L004 | Linda Chen | China | CNY | Auto | Female | $80,000.00 | 7.00% | 24 | 20APR2023 | 710 | 18000 |
5 | L005 | David Brown | UK | GBP | Business | Male | $25,000.00 | 6.50% | 12 | 05MAY2020 | 750 | 3000 |
6 | L006 | Noura Al-Fahad | UAE | AED | Personal | Female | $120,000.00 | 6.00% | 36 | 10JUN2021 | 730 | 20000 |
7 | L007 | Igor Petrov | Russia | RUB | Home | Male | $500,000.00 | 10.00% | 48 | 12JUL2022 | 660 | 30000 |
8 | L008 | Mei Tan | Singapore | SGD | Education | Female | $15,000.00 | 5.50% | 24 | 23AUG2021 | 770 | 5000 |
9 | L009 | Jose Silva | Brazil | BRL | Auto | Male | $40,000.00 | 11.00% | 30 | 01SEP2020 | 640 | 6000 |
10 | L010 | Maria Rossi | Italy | EUR | Business | Female | $35,000.00 | 6.80% | 60 | 14OCT2022 | 720 | 3500 |
11 | L011 | Tom Lee | South Korea | KRW | Home | Male | $30000000.00 | 9.20% | 48 | 05NOV2021 | 700 | 4200000 |
12 | L012 | Fatima Zahra | Morocco | MAD | Personal | Female | $100,000.00 | 8.50% | 36 | 22DEC2021 | 710 | 12000 |
13 | L013 | Juan Carlos | Spain | EUR | Auto | Male | $28,000.00 | 7.00% | 24 | 07JAN2023 | 690 | 2800 |
14 | L014 | Emily Davis | Canada | CAD | Education | Female | $22,000.00 | 6.20% | 48 | 19FEB2022 | 760 | 4100 |
15 | L015 | Yuki Nakamura | Japan | JPY | Business | Female | $2500000.00 | 5.80% | 60 | 11MAR2020 | 740 | 520000 |
16 | L016 | Ahmed Said | Egypt | EGP | Home | Male | $150,000.00 | 10.20% | 30 | 20APR2023 | 670 | 9000 |
Step 2: Summary using PROC CONTENTS and PROC PRINT
proc contents data=money_loans;
title "Dataset Structure - Global Money Loan Records";
run;
Output:
Dataset Structure - Global Money Loan Records |
Data Set Name | WORK.MONEY_LOANS | Observations | 16 |
---|---|---|---|
Member Type | DATA | Variables | 12 |
Engine | V9 | Indexes | 0 |
Created | 14/09/2015 00:04:19 | Observation Length | 128 |
Last Modified | 14/09/2015 00:04:19 | Deleted Observations | 0 |
Protection | Compressed | NO | |
Data Set Type | Sorted | NO | |
Label | |||
Data Representation | WINDOWS_64 | ||
Encoding | wlatin1 Western (Windows) |
Engine/Host Dependent Information | |
---|---|
Data Set Page Size | 65536 |
Number of Data Set Pages | 1 |
First Data Page | 1 |
Max Obs per Page | 511 |
Obs in First Data Page | 16 |
Number of Data Set Repairs | 0 |
ExtendObsCounter | YES |
Filename | C:\Users\Lenovo\AppData\Local\Temp\SAS Temporary Files\_TD17164_DESKTOP-QFAA4KV_\money_loans.sas7bdat |
Release Created | 9.0401M2 |
Host Created | X64_8HOME |
Alphabetic List of Variables and Attributes | ||||
---|---|---|---|---|
# | Variable | Type | Len | Format |
2 | Borrower_Name | Char | 25 | |
3 | Country | Char | 15 | |
11 | Credit_Score | Num | 8 | |
4 | Currency | Char | 10 | |
6 | Gender | Char | 6 | |
8 | Interest_Rate | Num | 8 | PERCENT8.2 |
7 | Loan_Amount | Num | 8 | DOLLAR12.2 |
1 | Loan_ID | Char | 8 | |
9 | Loan_Term_Months | Num | 8 | |
5 | Loan_Type | Char | 15 | |
12 | Monthly_Income | Num | 8 | |
10 | Start_Date | Num | 8 | DATE9. |
proc print data=money_loans (obs=10);
title "First 10 Observations - Loan Dataset";
run;
Output:
First 10 Observations - Loan Dataset
Obs | Loan_ID | Borrower_Name | Country | Currency | Loan_Type | Gender | Loan_Amount | Interest_Rate | Loan_Term_Months | Start_Date | Credit_Score | Monthly_Income |
---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | L001 | John Smith | USA | USD | Personal | Male | $50,000.00 | 7.50% | 60 | 01JAN2021 | 720 | 4000 |
2 | L002 | Ana Gomez | Mexico | MXN | Home | Female | $300,000.00 | 8.20% | 48 | 15FEB2022 | 680 | 3500 |
3 | L003 | Ravi Kumar | India | INR | Education | Male | $700,000.00 | 9.50% | 36 | 01MAR2021 | 650 | 25000 |
4 | L004 | Linda Chen | China | CNY | Auto | Female | $80,000.00 | 7.00% | 24 | 20APR2023 | 710 | 18000 |
5 | L005 | David Brown | UK | GBP | Business | Male | $25,000.00 | 6.50% | 12 | 05MAY2020 | 750 | 3000 |
6 | L006 | Noura Al-Fahad | UAE | AED | Personal | Female | $120,000.00 | 6.00% | 36 | 10JUN2021 | 730 | 20000 |
7 | L007 | Igor Petrov | Russia | RUB | Home | Male | $500,000.00 | 10.00% | 48 | 12JUL2022 | 660 | 30000 |
8 | L008 | Mei Tan | Singapore | SGD | Education | Female | $15,000.00 | 5.50% | 24 | 23AUG2021 | 770 | 5000 |
9 | L009 | Jose Silva | Brazil | BRL | Auto | Male | $40,000.00 | 11.00% | 30 | 01SEP2020 | 640 | 6000 |
10 | L010 | Maria Rossi | Italy | EUR | Business | Female | $35,000.00 | 6.80% | 60 | 14OCT2022 | 720 | 3500 |
Step 3: Calculate Derived Fields with Functions
data money_loans_enhanced;
set money_loans;
End_Date = intnx("month", Start_Date, Loan_Term_Months);
Loan_Duration_Years = round(Loan_Term_Months / 12, 0.1);
Total_Interest = Loan_Amount * Interest_Rate * Loan_Duration_Years;
Monthly_Installment = Loan_Amount / Loan_Term_Months + (Total_Interest / Loan_Term_Months);
format End_Date date9. Total_Interest dollar12.2 Monthly_Installment dollar12.2;
run;
proc print data=money_loans_enhanced;
run;
Output:
Obs | Loan_ID | Borrower_Name | Country | Currency | Loan_Type | Gender | Loan_Amount | Interest_Rate | Loan_Term_Months | Start_Date | Credit_Score | Monthly_Income | End_Date | Loan_Duration_Years | Total_Interest | Monthly_Installment |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | L001 | John Smith | USA | USD | Personal | Male | $50,000.00 | 7.50% | 60 | 01JAN2021 | 720 | 4000 | 01JAN2026 | 5.0 | $18,750.00 | $1,145.83 |
2 | L002 | Ana Gomez | Mexico | MXN | Home | Female | $300,000.00 | 8.20% | 48 | 15FEB2022 | 680 | 3500 | 01FEB2026 | 4.0 | $98,400.00 | $8,300.00 |
3 | L003 | Ravi Kumar | India | INR | Education | Male | $700,000.00 | 9.50% | 36 | 01MAR2021 | 650 | 25000 | 01MAR2024 | 3.0 | $199,500.00 | $24,986.11 |
4 | L004 | Linda Chen | China | CNY | Auto | Female | $80,000.00 | 7.00% | 24 | 20APR2023 | 710 | 18000 | 01APR2025 | 2.0 | $11,200.00 | $3,800.00 |
5 | L005 | David Brown | UK | GBP | Business | Male | $25,000.00 | 6.50% | 12 | 05MAY2020 | 750 | 3000 | 01MAY2021 | 1.0 | $1,625.00 | $2,218.75 |
6 | L006 | Noura Al-Fahad | UAE | AED | Personal | Female | $120,000.00 | 6.00% | 36 | 10JUN2021 | 730 | 20000 | 01JUN2024 | 3.0 | $21,600.00 | $3,933.33 |
7 | L007 | Igor Petrov | Russia | RUB | Home | Male | $500,000.00 | 10.00% | 48 | 12JUL2022 | 660 | 30000 | 01JUL2026 | 4.0 | $200,000.00 | $14,583.33 |
8 | L008 | Mei Tan | Singapore | SGD | Education | Female | $15,000.00 | 5.50% | 24 | 23AUG2021 | 770 | 5000 | 01AUG2023 | 2.0 | $1,650.00 | $693.75 |
9 | L009 | Jose Silva | Brazil | BRL | Auto | Male | $40,000.00 | 11.00% | 30 | 01SEP2020 | 640 | 6000 | 01MAR2023 | 2.5 | $11,000.00 | $1,700.00 |
10 | L010 | Maria Rossi | Italy | EUR | Business | Female | $35,000.00 | 6.80% | 60 | 14OCT2022 | 720 | 3500 | 01OCT2027 | 5.0 | $11,900.00 | $781.67 |
11 | L011 | Tom Lee | South Korea | KRW | Home | Male | $30000000.00 | 9.20% | 48 | 05NOV2021 | 700 | 4200000 | 01NOV2025 | 4.0 | $11040000.00 | $855,000.00 |
12 | L012 | Fatima Zahra | Morocco | MAD | Personal | Female | $100,000.00 | 8.50% | 36 | 22DEC2021 | 710 | 12000 | 01DEC2024 | 3.0 | $25,500.00 | $3,486.11 |
13 | L013 | Juan Carlos | Spain | EUR | Auto | Male | $28,000.00 | 7.00% | 24 | 07JAN2023 | 690 | 2800 | 01JAN2025 | 2.0 | $3,920.00 | $1,330.00 |
14 | L014 | Emily Davis | Canada | CAD | Education | Female | $22,000.00 | 6.20% | 48 | 19FEB2022 | 760 | 4100 | 01FEB2026 | 4.0 | $5,456.00 | $572.00 |
15 | L015 | Yuki Nakamura | Japan | JPY | Business | Female | $2500000.00 | 5.80% | 60 | 11MAR2020 | 740 | 520000 | 01MAR2025 | 5.0 | $725,000.00 | $53,750.00 |
16 | L016 | Ahmed Said | Egypt | EGP | Home | Male | $150,000.00 | 10.20% | 30 | 20APR2023 | 670 | 9000 | 01OCT2025 | 2.5 | $38,250.00 | $6,275.00 |
Step 4: Analyze with PROC MEANS and PROC FREQ
proc means data=money_loans_enhanced n mean median min max std maxdec=2;
var Loan_Amount Interest_Rate Total_Interest Monthly_Income Monthly_Installment;
title "Summary Statistics of Financial Fields";
run;
Output:
Summary Statistics of Financial Fields |
Variable | N | Mean | Median | Minimum | Maximum | Std Dev | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
|
|
|
|
|
proc freq data=money_loans_enhanced;
tables Country Gender Loan_Type Credit_Score;
title "Frequency Distribution of Key Categorical Fields";
run;
Output:
Frequency Distribution of Key Categorical Fields |
Country | Frequency | Percent | Cumulative Frequency |
Cumulative Percent |
---|---|---|---|---|
Brazil | 1 | 6.25 | 1 | 6.25 |
Canada | 1 | 6.25 | 2 | 12.50 |
China | 1 | 6.25 | 3 | 18.75 |
Egypt | 1 | 6.25 | 4 | 25.00 |
India | 1 | 6.25 | 5 | 31.25 |
Italy | 1 | 6.25 | 6 | 37.50 |
Japan | 1 | 6.25 | 7 | 43.75 |
Mexico | 1 | 6.25 | 8 | 50.00 |
Morocco | 1 | 6.25 | 9 | 56.25 |
Russia | 1 | 6.25 | 10 | 62.50 |
Singapore | 1 | 6.25 | 11 | 68.75 |
South Korea | 1 | 6.25 | 12 | 75.00 |
Spain | 1 | 6.25 | 13 | 81.25 |
UAE | 1 | 6.25 | 14 | 87.50 |
UK | 1 | 6.25 | 15 | 93.75 |
USA | 1 | 6.25 | 16 | 100.00 |
Gender | Frequency | Percent | Cumulative Frequency |
Cumulative Percent |
---|---|---|---|---|
Female | 8 | 50.00 | 8 | 50.00 |
Male | 8 | 50.00 | 16 | 100.00 |
Loan_Type | Frequency | Percent | Cumulative Frequency |
Cumulative Percent |
---|---|---|---|---|
Auto | 3 | 18.75 | 3 | 18.75 |
Business | 3 | 18.75 | 6 | 37.50 |
Education | 3 | 18.75 | 9 | 56.25 |
Home | 4 | 25.00 | 13 | 81.25 |
Personal | 3 | 18.75 | 16 | 100.00 |
Credit_Score | Frequency | Percent | Cumulative Frequency |
Cumulative Percent |
---|---|---|---|---|
640 | 1 | 6.25 | 1 | 6.25 |
650 | 1 | 6.25 | 2 | 12.50 |
660 | 1 | 6.25 | 3 | 18.75 |
670 | 1 | 6.25 | 4 | 25.00 |
680 | 1 | 6.25 | 5 | 31.25 |
690 | 1 | 6.25 | 6 | 37.50 |
700 | 1 | 6.25 | 7 | 43.75 |
710 | 2 | 12.50 | 9 | 56.25 |
720 | 2 | 12.50 | 11 | 68.75 |
730 | 1 | 6.25 | 12 | 75.00 |
740 | 1 | 6.25 | 13 | 81.25 |
750 | 1 | 6.25 | 14 | 87.50 |
760 | 1 | 6.25 | 15 | 93.75 |
770 | 1 | 6.25 | 16 | 100.00 |
Step 5: Sorting and Filtering with PROC SQL
proc sql;
create table top_borrowers as
select Borrower_Name, Country, Loan_Amount, Monthly_Income
from money_loans_enhanced
where Credit_Score >= 720
order by Loan_Amount desc;
title "Top Borrowers with High Credit Score";
quit;
proc print;run;
Output:
Top Borrowers with High Credit Score |
Obs | Borrower_Name | Country | Loan_Amount | Monthly_Income |
---|---|---|---|---|
1 | Yuki Nakamura | Japan | $2500000.00 | 520000 |
2 | Noura Al-Fahad | UAE | $120,000.00 | 20000 |
3 | John Smith | USA | $50,000.00 | 4000 |
4 | Maria Rossi | Italy | $35,000.00 | 3500 |
5 | David Brown | UK | $25,000.00 | 3000 |
6 | Emily Davis | Canada | $22,000.00 | 4100 |
7 | Mei Tan | Singapore | $15,000.00 | 5000 |
Step 6: Macro for Country-Wise Loan Summary
%macro loan_by_country(ctry);
proc sql;
title "Loan Summary for &ctry";
select
count(*) as Total_Loans,
mean(Loan_Amount) as Avg_Loan format=dollar10.2,
mean(Interest_Rate) as Avg_Rate format=percent6.2,
sum(Total_Interest) as Total_Interest_Earned format=dollar15.2
from money_loans_enhanced
where Country = "&ctry";
quit;
%mend;
%loan_by_country(India);
Output:
Loan Summary for India |
Total_Loans | Avg_Loan | Avg_Rate | Total_Interest_Earned |
---|---|---|---|
1 | $700000.00 | 9.5% | $199,500.00 |
%loan_by_country(USA);
Output:
Loan Summary for USA |
Total_Loans | Avg_Loan | Avg_Rate | Total_Interest_Earned |
---|---|---|---|
1 | $50,000.00 | 7.5% | $18,750.00 |
%loan_by_country(Brazil);
Output:
Loan Summary for Brazil |
Total_Loans | Avg_Loan | Avg_Rate | Total_Interest_Earned |
---|---|---|---|
1 | $40,000.00 | 11% | $11,000.00 |
Step 7: PROC FORMAT to Enhance Output
proc format;
value $genderfmt
"Male" = "M"
"Female" = "F";
value scoregrp
low -< 650 = "Low"
650 -< 700 = "Moderate"
700 - high = "High";
run;
data money_loans_labeled;
set money_loans_enhanced;
Gender_Code = put(Gender, $genderfmt.);
Score_Category = put(Credit_Score, scoregrp.);
run;
proc print;run;
Output:
Obs | Loan_ID | Borrower_Name | Country | Currency | Loan_Type | Gender | Loan_Amount | Interest_Rate | Loan_Term_Months | Start_Date | Credit_Score | Monthly_Income | End_Date | Loan_Duration_Years | Total_Interest | Monthly_Installment | Gender_Code | Score_Category |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | L001 | John Smith | USA | USD | Personal | Male | $50,000.00 | 7.50% | 60 | 01JAN2021 | 720 | 4000 | 01JAN2026 | 5.0 | $18,750.00 | $1,145.83 | M | High |
2 | L002 | Ana Gomez | Mexico | MXN | Home | Female | $300,000.00 | 8.20% | 48 | 15FEB2022 | 680 | 3500 | 01FEB2026 | 4.0 | $98,400.00 | $8,300.00 | F | Moderate |
3 | L003 | Ravi Kumar | India | INR | Education | Male | $700,000.00 | 9.50% | 36 | 01MAR2021 | 650 | 25000 | 01MAR2024 | 3.0 | $199,500.00 | $24,986.11 | M | Moderate |
4 | L004 | Linda Chen | China | CNY | Auto | Female | $80,000.00 | 7.00% | 24 | 20APR2023 | 710 | 18000 | 01APR2025 | 2.0 | $11,200.00 | $3,800.00 | F | High |
5 | L005 | David Brown | UK | GBP | Business | Male | $25,000.00 | 6.50% | 12 | 05MAY2020 | 750 | 3000 | 01MAY2021 | 1.0 | $1,625.00 | $2,218.75 | M | High |
6 | L006 | Noura Al-Fahad | UAE | AED | Personal | Female | $120,000.00 | 6.00% | 36 | 10JUN2021 | 730 | 20000 | 01JUN2024 | 3.0 | $21,600.00 | $3,933.33 | F | High |
7 | L007 | Igor Petrov | Russia | RUB | Home | Male | $500,000.00 | 10.00% | 48 | 12JUL2022 | 660 | 30000 | 01JUL2026 | 4.0 | $200,000.00 | $14,583.33 | M | Moderate |
8 | L008 | Mei Tan | Singapore | SGD | Education | Female | $15,000.00 | 5.50% | 24 | 23AUG2021 | 770 | 5000 | 01AUG2023 | 2.0 | $1,650.00 | $693.75 | F | High |
9 | L009 | Jose Silva | Brazil | BRL | Auto | Male | $40,000.00 | 11.00% | 30 | 01SEP2020 | 640 | 6000 | 01MAR2023 | 2.5 | $11,000.00 | $1,700.00 | M | Low |
10 | L010 | Maria Rossi | Italy | EUR | Business | Female | $35,000.00 | 6.80% | 60 | 14OCT2022 | 720 | 3500 | 01OCT2027 | 5.0 | $11,900.00 | $781.67 | F | High |
11 | L011 | Tom Lee | South Korea | KRW | Home | Male | $30000000.00 | 9.20% | 48 | 05NOV2021 | 700 | 4200000 | 01NOV2025 | 4.0 | $11040000.00 | $855,000.00 | M | High |
12 | L012 | Fatima Zahra | Morocco | MAD | Personal | Female | $100,000.00 | 8.50% | 36 | 22DEC2021 | 710 | 12000 | 01DEC2024 | 3.0 | $25,500.00 | $3,486.11 | F | High |
13 | L013 | Juan Carlos | Spain | EUR | Auto | Male | $28,000.00 | 7.00% | 24 | 07JAN2023 | 690 | 2800 | 01JAN2025 | 2.0 | $3,920.00 | $1,330.00 | M | Moderate |
14 | L014 | Emily Davis | Canada | CAD | Education | Female | $22,000.00 | 6.20% | 48 | 19FEB2022 | 760 | 4100 | 01FEB2026 | 4.0 | $5,456.00 | $572.00 | F | High |
15 | L015 | Yuki Nakamura | Japan | JPY | Business | Female | $2500000.00 | 5.80% | 60 | 11MAR2020 | 740 | 520000 | 01MAR2025 | 5.0 | $725,000.00 | $53,750.00 | F | High |
16 | L016 | Ahmed Said | Egypt | EGP | Home | Male | $150,000.00 | 10.20% | 30 | 20APR2023 | 670 | 9000 | 01OCT2025 | 2.5 | $38,250.00 | $6,275.00 | M | Moderate |
proc freq data=money_loans_labeled;
tables Score_Category;
title "Credit Score Categories";
run;
Output:
Credit Score Categories |
Score_Category | Frequency | Percent | Cumulative Frequency |
Cumulative Percent |
---|---|---|---|---|
High | 10 | 62.50 | 10 | 62.50 |
Low | 1 | 6.25 | 11 | 68.75 |
Moderate | 5 | 31.25 | 16 | 100.00 |
Step 8: Create a Report with PROC REPORT
proc report data=money_loans_enhanced nowd;
column Loan_ID Borrower_Name Country Loan_Amount Loan_Term_Months Interest_Rate Computed_EMI;
define Loan_ID / display;
define Borrower_Name / display;
define Country / display;
define Loan_Amount / display format=dollar12.2;
define Loan_Term_Months / display;
define Interest_Rate / display format=percent6.2;
define Computed_EMI / computed format=dollar10.2 'Recomputed EMI';
compute Computed_EMI;
Computed_EMI = Loan_Amount / Loan_Term_Months;
endcomp;
title "Loan Report with Recomputed EMI Using PROC REPORT";
run;
Output:
Loan Report with Recomputed EMI Using PROC REPORT |
Loan_ID | Borrower_Name | Country | Loan_Amount | Loan_Term_Months | Interest_Rate | Recomputed EMI |
---|---|---|---|---|---|---|
L001 | John Smith | USA | $50,000.00 | 60 | 7.5% | $833.33 |
L002 | Ana Gomez | Mexico | $300,000.00 | 48 | 8.2% | $6,250.00 |
L003 | Ravi Kumar | India | $700,000.00 | 36 | 9.5% | $19,444.44 |
L004 | Linda Chen | China | $80,000.00 | 24 | 7.0% | $3,333.33 |
L005 | David Brown | UK | $25,000.00 | 12 | 6.5% | $2,083.33 |
L006 | Noura Al-Fahad | UAE | $120,000.00 | 36 | 6.0% | $3,333.33 |
L007 | Igor Petrov | Russia | $500,000.00 | 48 | 10% | $10,416.67 |
L008 | Mei Tan | Singapore | $15,000.00 | 24 | 5.5% | $625.00 |
L009 | Jose Silva | Brazil | $40,000.00 | 30 | 11% | $1,333.33 |
L010 | Maria Rossi | Italy | $35,000.00 | 60 | 6.8% | $583.33 |
L011 | Tom Lee | South Korea | $30000000.00 | 48 | 9.2% | $625000.00 |
L012 | Fatima Zahra | Morocco | $100,000.00 | 36 | 8.5% | $2,777.78 |
L013 | Juan Carlos | Spain | $28,000.00 | 24 | 7.0% | $1,166.67 |
L014 | Emily Davis | Canada | $22,000.00 | 48 | 6.2% | $458.33 |
L015 | Yuki Nakamura | Japan | $2500000.00 | 60 | 5.8% | $41,666.67 |
L016 | Ahmed Said | Egypt | $150,000.00 | 30 | 10% | $5,000.00 |
Step 9: Final Output Snapshot
proc print data=money_loans_labeled label;
var Loan_ID Borrower_Name Country Loan_Amount Loan_Type Gender_Code Score_Category
Monthly_Income Monthly_Installment;
title "Final Enhanced Loan Dataset (Preview)";
run;
Final Enhanced Loan Dataset (Preview) |
Obs | Loan_ID | Borrower_Name | Country | Loan_Amount | Loan_Type | Gender_Code | Score_Category | Monthly_Income | Monthly_Installment |
---|---|---|---|---|---|---|---|---|---|
1 | L001 | John Smith | USA | $50,000.00 | Personal | M | High | 4000 | $1,145.83 |
2 | L002 | Ana Gomez | Mexico | $300,000.00 | Home | F | Moderate | 3500 | $8,300.00 |
3 | L003 | Ravi Kumar | India | $700,000.00 | Education | M | Moderate | 25000 | $24,986.11 |
4 | L004 | Linda Chen | China | $80,000.00 | Auto | F | High | 18000 | $3,800.00 |
5 | L005 | David Brown | UK | $25,000.00 | Business | M | High | 3000 | $2,218.75 |
6 | L006 | Noura Al-Fahad | UAE | $120,000.00 | Personal | F | High | 20000 | $3,933.33 |
7 | L007 | Igor Petrov | Russia | $500,000.00 | Home | M | Moderate | 30000 | $14,583.33 |
8 | L008 | Mei Tan | Singapore | $15,000.00 | Education | F | High | 5000 | $693.75 |
9 | L009 | Jose Silva | Brazil | $40,000.00 | Auto | M | Low | 6000 | $1,700.00 |
10 | L010 | Maria Rossi | Italy | $35,000.00 | Business | F | High | 3500 | $781.67 |
11 | L011 | Tom Lee | South Korea | $30000000.00 | Home | M | High | 4200000 | $855,000.00 |
12 | L012 | Fatima Zahra | Morocco | $100,000.00 | Personal | F | High | 12000 | $3,486.11 |
13 | L013 | Juan Carlos | Spain | $28,000.00 | Auto | M | Moderate | 2800 | $1,330.00 |
14 | L014 | Emily Davis | Canada | $22,000.00 | Education | F | High | 4100 | $572.00 |
15 | L015 | Yuki Nakamura | Japan | $2500000.00 | Business | F | High | 520000 | $53,750.00 |
16 | L016 | Ahmed Said | Egypt | $150,000.00 | Home | M | Moderate | 9000 | $6,275.00 |
To Visit My Previous E-Commerce Dataset:Click HereTo Visit My Previous Length,Input,Retain Statements:Click HereTo Visit My Previous Urban Traffic Dataset:Click HereTo Visit My Previous Home Energy Consumption Dataset:Click Here--->PLEASE FOLLOW OUR BLOG FOR MORE INFORMATION.--->PLEASE DO COMMENTS AND SHARE OUR BLOG.PLEASE FOLLOW OUR FACEBOOK PAGE CLICK HEREPLEASE FOLLOW OUR INSTAGRAM PAGE CLICK HERE
- Get link
- X
- Other Apps
Comments
Post a Comment