265.Is higher income really leading to better savings, or just higher spending?A Complete Sas Study
Is higher income really leading to better savings, or just higher spending?A Complete Sas Study
/*Creating a dataset of money in India */
1) DATA CREATION
options nocenter;
data money_in_india;
length HouseholdID $8 State $20 City $25 Urban_Rural $6 Income_Source $15 Bank_Type $15 Predominant_Expense $20;
format Monthly_Income Monthly_Savings Cash_Share Digital_Share Remittance_Amount Financial_Literacy 8.2;
infile datalines dlm=',' dsd truncover;
input HouseholdID :$8. State :$20. City :$25. Urban_Rural :$6. Income_Source :$15. Bank_Type :$15. Predominant_Expense :$20.
Monthly_Income Monthly_Savings Cash_Share Digital_Share Remittance_Amount Financial_Literacy;
if Monthly_Income > 0 then Savings_Rate = Monthly_Savings / Monthly_Income;
else Savings_Rate = .;
length Income_Tier $15;
if Monthly_Income >= 100000 then Income_Tier = 'High';
else if Monthly_Income >= 30000 then Income_Tier = 'Upper-Mid';
else if Monthly_Income >= 15000 then Income_Tier = 'Mid';
else Income_Tier = 'Low';
datalines;
HH001,Maharashtra,Mumbai,Urban,Salaried,Private Bank,Rent & Bills,85000,15000,20,80,0,7.8
HH002,Delhi,New Delhi,Urban,Salaried,Public Bank,Food,45000,5000,30,70,0,6.4
HH003,Karnataka,Bengaluru,Urban,Self-Employed,Private Bank,Education,60000,8000,25,75,5000,7.0
HH004,Kerala,Thiruvananthapuram,Urban,Pensioner,Public Bank,Healthcare,22000,4000,50,50,10000,6.2
HH005,Uttar Pradesh,Lucknow,Rural,Agriculture,Cooperative,Basic Needs,12000,2000,80,20,2000,4.9
HH006,Tamil Nadu,Chennai,Urban,Salaried,Private Bank,Transport,35000,6000,35,65,0,6.7
HH007,West Bengal,Kolkata,Urban,Self-Employed,Private Bank,Food,28000,3000,60,40,0,5.8
HH008,Rajasthan,Jaipur,Rural,Agriculture,Cooperative,Utilities,15000,2500,70,30,0,5.2
HH009,Bihar,Patna,Rural,Labor,No Bank,Cash Expenses,9000,500,90,10,0,3.8
HH010,Telangana,Hyderabad,Urban,Salaried,Private Bank,Entertainment,52000,7000,30,70,0,6.9
HH011,Gujarat,Ahmedabad,Urban,Self-Employed,Public Bank,Food,33000,3500,45,55,0,6.0
HH012,Odisha,Bhubaneswar,Rural,Agriculture,Cooperative,Basic Needs,14000,1200,75,25,0,4.7
HH013,Madhya Pradesh,Bhopal,Rural,Agriculture,Cooperative,Education,16000,2000,65,35,0,5.0
HH014,Assam,Guwahati,Urban,Salaried,Public Bank,Transport,26000,3000,40,60,0,5.6
HH015,Jharkhand,Ranchi,Rural,Labor,No Bank,Cash Expenses,11000,700,85,15,0,4.1
HH016,Haryana,Gurugram,Urban,Salaried,Private Bank,Rent & Bills,98000,20000,22,78,0,8.1
HH017,Punjab,Chandigarh,Urban,Pensioner,Public Bank,Healthcare,30000,4000,48,52,0,6.3
HH018,Chhattisgarh,Raipur,Rural,Agriculture,Cooperative,Basic Needs,13000,1500,78,22,0,4.5
HH019,Andhra Pradesh,Vijayawada,Urban,Self-Employed,Private Bank,Education,29000,2500,55,45,0,5.7
HH020,Goa,Panaji,Urban,Tourism,Private Bank,Entertainment,72000,10000,28,72,15000,7.4
;
run;
proc print;run;
Output:
| Obs | HouseholdID | State | City | Urban_Rural | Income_Source | Bank_Type | Predominant_Expense | Monthly_Income | Monthly_Savings | Cash_Share | Digital_Share | Remittance_Amount | Financial_Literacy | Savings_Rate | Income_Tier |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | HH001 | Maharashtra | Mumbai | Urban | Salaried | Private Bank | Rent & Bills | 85000.00 | 15000.00 | 20.00 | 80.00 | 0.00 | 7.80 | 0.17647 | Upper-Mid |
| 2 | HH002 | Delhi | New Delhi | Urban | Salaried | Public Bank | Food | 45000.00 | 5000.00 | 30.00 | 70.00 | 0.00 | 6.40 | 0.11111 | Upper-Mid |
| 3 | HH003 | Karnataka | Bengaluru | Urban | Self-Employed | Private Bank | Education | 60000.00 | 8000.00 | 25.00 | 75.00 | 5000.00 | 7.00 | 0.13333 | Upper-Mid |
| 4 | HH004 | Kerala | Thiruvananthapuram | Urban | Pensioner | Public Bank | Healthcare | 22000.00 | 4000.00 | 50.00 | 50.00 | 10000.00 | 6.20 | 0.18182 | Mid |
| 5 | HH005 | Uttar Pradesh | Lucknow | Rural | Agriculture | Cooperative | Basic Needs | 12000.00 | 2000.00 | 80.00 | 20.00 | 2000.00 | 4.90 | 0.16667 | Low |
| 6 | HH006 | Tamil Nadu | Chennai | Urban | Salaried | Private Bank | Transport | 35000.00 | 6000.00 | 35.00 | 65.00 | 0.00 | 6.70 | 0.17143 | Upper-Mid |
| 7 | HH007 | West Bengal | Kolkata | Urban | Self-Employed | Private Bank | Food | 28000.00 | 3000.00 | 60.00 | 40.00 | 0.00 | 5.80 | 0.10714 | Mid |
| 8 | HH008 | Rajasthan | Jaipur | Rural | Agriculture | Cooperative | Utilities | 15000.00 | 2500.00 | 70.00 | 30.00 | 0.00 | 5.20 | 0.16667 | Mid |
| 9 | HH009 | Bihar | Patna | Rural | Labor | No Bank | Cash Expenses | 9000.00 | 500.00 | 90.00 | 10.00 | 0.00 | 3.80 | 0.05556 | Low |
| 10 | HH010 | Telangana | Hyderabad | Urban | Salaried | Private Bank | Entertainment | 52000.00 | 7000.00 | 30.00 | 70.00 | 0.00 | 6.90 | 0.13462 | Upper-Mid |
| 11 | HH011 | Gujarat | Ahmedabad | Urban | Self-Employed | Public Bank | Food | 33000.00 | 3500.00 | 45.00 | 55.00 | 0.00 | 6.00 | 0.10606 | Upper-Mid |
| 12 | HH012 | Odisha | Bhubaneswar | Rural | Agriculture | Cooperative | Basic Needs | 14000.00 | 1200.00 | 75.00 | 25.00 | 0.00 | 4.70 | 0.08571 | Low |
| 13 | HH013 | Madhya Pradesh | Bhopal | Rural | Agriculture | Cooperative | Education | 16000.00 | 2000.00 | 65.00 | 35.00 | 0.00 | 5.00 | 0.12500 | Mid |
| 14 | HH014 | Assam | Guwahati | Urban | Salaried | Public Bank | Transport | 26000.00 | 3000.00 | 40.00 | 60.00 | 0.00 | 5.60 | 0.11538 | Mid |
| 15 | HH015 | Jharkhand | Ranchi | Rural | Labor | No Bank | Cash Expenses | 11000.00 | 700.00 | 85.00 | 15.00 | 0.00 | 4.10 | 0.06364 | Low |
| 16 | HH016 | Haryana | Gurugram | Urban | Salaried | Private Bank | Rent & Bills | 98000.00 | 20000.00 | 22.00 | 78.00 | 0.00 | 8.10 | 0.20408 | Upper-Mid |
| 17 | HH017 | Punjab | Chandigarh | Urban | Pensioner | Public Bank | Healthcare | 30000.00 | 4000.00 | 48.00 | 52.00 | 0.00 | 6.30 | 0.13333 | Upper-Mid |
| 18 | HH018 | Chhattisgarh | Raipur | Rural | Agriculture | Cooperative | Basic Needs | 13000.00 | 1500.00 | 78.00 | 22.00 | 0.00 | 4.50 | 0.11538 | Low |
| 19 | HH019 | Andhra Pradesh | Vijayawada | Urban | Self-Employed | Private Bank | Education | 29000.00 | 2500.00 | 55.00 | 45.00 | 0.00 | 5.70 | 0.08621 | Mid |
| 20 | HH020 | Goa | Panaji | Urban | Tourism | Private Bank | Entertainment | 72000.00 | 10000.00 | 28.00 | 72.00 | 15000.00 | 7.40 | 0.13889 | Upper-Mid |
2) FORMATS and LABELS
proc format;
value $urbanfmt 'Urban'='Urban'
'Rural'='Rural'
other ='Unknown';
value $tierfmt 'High'='High (>=100k)'
'Upper-Mid'='Upper-Mid (30k-99k)'
'Mid'='Mid (15k-29k)'
'Low'='Low (<15k)';
run;
proc datasets library=work nolist;
modify money_in_india;
label Monthly_Income = 'Monthly Income (INR)'
Monthly_Savings = 'Monthly Savings (INR)'
Cash_Share = 'Cash Share Percentage'
Digital_Share = 'Digital Share Percentage'
Financial_Literacy = 'Financial Literacy Score (1-10)'
Remittance_Amount = 'Monthly Remittance (INR)'
Savings_Rate = 'Savings Rate (Savings/Income)';
quit;
3) BASIC EXPLORATION
proc contents data=money_in_india short;
run;
Output:
The CONTENTS Procedure
| Alphabetic List of Variables for WORK.MONEY_IN_INDIA |
|---|
| Bank_Type Cash_Share City Digital_Share Financial_Literacy HouseholdID Income_Source Income_Tier Monthly_Income Monthly_Savings Predominant_Expense Remittance_Amount Savings_Rate State Urban_Rural |
proc print data=money_in_india noobs label;
run;
Output:
| HouseholdID | State | City | Urban_Rural | Income_Source | Bank_Type | Predominant_Expense | Monthly Income (INR) | Monthly Savings (INR) | Cash Share Percentage | Digital Share Percentage | Monthly Remittance (INR) | Financial Literacy Score (1-10) | Savings Rate (Savings/Income) | Income_Tier |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| HH001 | Maharashtra | Mumbai | Urban | Salaried | Private Bank | Rent & Bills | 85000.00 | 15000.00 | 20.00 | 80.00 | 0.00 | 7.80 | 0.17647 | Upper-Mid |
| HH002 | Delhi | New Delhi | Urban | Salaried | Public Bank | Food | 45000.00 | 5000.00 | 30.00 | 70.00 | 0.00 | 6.40 | 0.11111 | Upper-Mid |
| HH003 | Karnataka | Bengaluru | Urban | Self-Employed | Private Bank | Education | 60000.00 | 8000.00 | 25.00 | 75.00 | 5000.00 | 7.00 | 0.13333 | Upper-Mid |
| HH004 | Kerala | Thiruvananthapuram | Urban | Pensioner | Public Bank | Healthcare | 22000.00 | 4000.00 | 50.00 | 50.00 | 10000.00 | 6.20 | 0.18182 | Mid |
| HH005 | Uttar Pradesh | Lucknow | Rural | Agriculture | Cooperative | Basic Needs | 12000.00 | 2000.00 | 80.00 | 20.00 | 2000.00 | 4.90 | 0.16667 | Low |
| HH006 | Tamil Nadu | Chennai | Urban | Salaried | Private Bank | Transport | 35000.00 | 6000.00 | 35.00 | 65.00 | 0.00 | 6.70 | 0.17143 | Upper-Mid |
| HH007 | West Bengal | Kolkata | Urban | Self-Employed | Private Bank | Food | 28000.00 | 3000.00 | 60.00 | 40.00 | 0.00 | 5.80 | 0.10714 | Mid |
| HH008 | Rajasthan | Jaipur | Rural | Agriculture | Cooperative | Utilities | 15000.00 | 2500.00 | 70.00 | 30.00 | 0.00 | 5.20 | 0.16667 | Mid |
| HH009 | Bihar | Patna | Rural | Labor | No Bank | Cash Expenses | 9000.00 | 500.00 | 90.00 | 10.00 | 0.00 | 3.80 | 0.05556 | Low |
| HH010 | Telangana | Hyderabad | Urban | Salaried | Private Bank | Entertainment | 52000.00 | 7000.00 | 30.00 | 70.00 | 0.00 | 6.90 | 0.13462 | Upper-Mid |
| HH011 | Gujarat | Ahmedabad | Urban | Self-Employed | Public Bank | Food | 33000.00 | 3500.00 | 45.00 | 55.00 | 0.00 | 6.00 | 0.10606 | Upper-Mid |
| HH012 | Odisha | Bhubaneswar | Rural | Agriculture | Cooperative | Basic Needs | 14000.00 | 1200.00 | 75.00 | 25.00 | 0.00 | 4.70 | 0.08571 | Low |
| HH013 | Madhya Pradesh | Bhopal | Rural | Agriculture | Cooperative | Education | 16000.00 | 2000.00 | 65.00 | 35.00 | 0.00 | 5.00 | 0.12500 | Mid |
| HH014 | Assam | Guwahati | Urban | Salaried | Public Bank | Transport | 26000.00 | 3000.00 | 40.00 | 60.00 | 0.00 | 5.60 | 0.11538 | Mid |
| HH015 | Jharkhand | Ranchi | Rural | Labor | No Bank | Cash Expenses | 11000.00 | 700.00 | 85.00 | 15.00 | 0.00 | 4.10 | 0.06364 | Low |
| HH016 | Haryana | Gurugram | Urban | Salaried | Private Bank | Rent & Bills | 98000.00 | 20000.00 | 22.00 | 78.00 | 0.00 | 8.10 | 0.20408 | Upper-Mid |
| HH017 | Punjab | Chandigarh | Urban | Pensioner | Public Bank | Healthcare | 30000.00 | 4000.00 | 48.00 | 52.00 | 0.00 | 6.30 | 0.13333 | Upper-Mid |
| HH018 | Chhattisgarh | Raipur | Rural | Agriculture | Cooperative | Basic Needs | 13000.00 | 1500.00 | 78.00 | 22.00 | 0.00 | 4.50 | 0.11538 | Low |
| HH019 | Andhra Pradesh | Vijayawada | Urban | Self-Employed | Private Bank | Education | 29000.00 | 2500.00 | 55.00 | 45.00 | 0.00 | 5.70 | 0.08621 | Mid |
| HH020 | Goa | Panaji | Urban | Tourism | Private Bank | Entertainment | 72000.00 | 10000.00 | 28.00 | 72.00 | 15000.00 | 7.40 | 0.13889 | Upper-Mid |
proc freq data=money_in_india;
tables State Urban_Rural Income_Tier Bank_Type / nocum norow nocol;
run;
Output:
The FREQ Procedure
| State | Frequency | Percent |
|---|---|---|
| Andhra Pradesh | 1 | 5.00 |
| Assam | 1 | 5.00 |
| Bihar | 1 | 5.00 |
| Chhattisgarh | 1 | 5.00 |
| Delhi | 1 | 5.00 |
| Goa | 1 | 5.00 |
| Gujarat | 1 | 5.00 |
| Haryana | 1 | 5.00 |
| Jharkhand | 1 | 5.00 |
| Karnataka | 1 | 5.00 |
| Kerala | 1 | 5.00 |
| Madhya Pradesh | 1 | 5.00 |
| Maharashtra | 1 | 5.00 |
| Odisha | 1 | 5.00 |
| Punjab | 1 | 5.00 |
| Rajasthan | 1 | 5.00 |
| Tamil Nadu | 1 | 5.00 |
| Telangana | 1 | 5.00 |
| Uttar Pradesh | 1 | 5.00 |
| West Bengal | 1 | 5.00 |
| Urban_Rural | Frequency | Percent |
|---|---|---|
| Rural | 7 | 35.00 |
| Urban | 13 | 65.00 |
| Income_Tier | Frequency | Percent |
|---|---|---|
| Low | 5 | 25.00 |
| Mid | 6 | 30.00 |
| Upper-Mid | 9 | 45.00 |
| Bank_Type | Frequency | Percent |
|---|---|---|
| Cooperative | 5 | 25.00 |
| No Bank | 2 | 10.00 |
| Private Bank | 8 | 40.00 |
| Public Bank | 5 | 25.00 |
proc means data=money_in_india n mean median std min max nmiss;
var Monthly_Income Monthly_Savings Cash_Share Digital_Share Remittance_Amount
Financial_Literacy Savings_Rate;
run;
Output:
The MEANS Procedure
| Variable | Label | N | Mean | Median | Std Dev | Minimum | Maximum | N Miss |
|---|---|---|---|---|---|---|---|---|
Monthly_Income Monthly_Savings Cash_Share Digital_Share Remittance_Amount Financial_Literacy Savings_Rate | Monthly Income (INR) Monthly Savings (INR) Cash Share Percentage Digital Share Percentage Monthly Remittance (INR) Financial Literacy Score (1-10) Savings Rate (Savings/Income) | 20 20 20 20 20 20 20 | 35250.00 5070.00 51.5500000 48.4500000 1600.00 5.9050000 0.1289250 | 28500.00 3250.00 49.0000000 51.0000000 0 5.9000000 0.1291667 | 25835.26 4984.62 22.6912341 22.6912341 3992.10 1.2041485 0.0401098 | 9000.00 500.0000000 20.0000000 10.0000000 0 3.8000000 0.0555556 | 98000.00 20000.00 90.0000000 80.0000000 15000.00 8.1000000 0.2040816 | 0 0 0 0 0 0 0 |
proc univariate data=money_in_india cibasic;
var Monthly_Income Monthly_Savings Financial_Literacy;
histogram Monthly_Income / normal;
run;
Output:
The UNIVARIATE Procedure
Variable: Monthly_Income (Monthly Income (INR))
| Moments | |||
|---|---|---|---|
| N | 20 | Sum Weights | 20 |
| Mean | 35250 | Sum Observations | 705000 |
| Std Deviation | 25835.2574 | Variance | 667460526 |
| Skewness | 1.2065323 | Kurtosis | 0.64882935 |
| Uncorrected SS | 3.7533E10 | Corrected SS | 1.26818E10 |
| Coeff Variation | 73.2915104 | Std Error Mean | 5776.93918 |
| Basic Statistical Measures | |||
|---|---|---|---|
| Location | Variability | ||
| Mean | 35250.00 | Std Deviation | 25835 |
| Median | 28500.00 | Variance | 667460526 |
| Mode | . | Range | 89000 |
| Interquartile Range | 34000 | ||
| Basic Confidence Limits Assuming Normality | |||
|---|---|---|---|
| Parameter | Estimate | 95% Confidence Limits | |
| Mean | 35250 | 23159 | 47341 |
| Std Deviation | 25835 | 19647 | 37734 |
| Variance | 667460526 | 386022885 | 1423873186 |
| Tests for Location: Mu0=0 | ||||
|---|---|---|---|---|
| Test | Statistic | p Value | ||
| Student's t | t | 6.101847 | Pr > |t| | <.0001 |
| Sign | M | 10 | Pr >= |M| | <.0001 |
| Signed Rank | S | 105 | Pr >= |S| | <.0001 |
| Quantiles (Definition 5) | |
|---|---|
| Level | Quantile |
| 100% Max | 98000 |
| 99% | 98000 |
| 95% | 91500 |
| 90% | 78500 |
| 75% Q3 | 48500 |
| 50% Median | 28500 |
| 25% Q1 | 14500 |
| 10% | 11500 |
| 5% | 10000 |
| 1% | 9000 |
| 0% Min | 9000 |
| Extreme Observations | |||
|---|---|---|---|
| Lowest | Highest | ||
| Value | Obs | Value | Obs |
| 9000 | 9 | 52000 | 10 |
| 11000 | 15 | 60000 | 3 |
| 12000 | 5 | 72000 | 20 |
| 13000 | 18 | 85000 | 1 |
| 14000 | 12 | 98000 | 16 |
The UNIVARIATE Procedure
The UNIVARIATE Procedure
Fitted Normal Distribution for Monthly_Income (Monthly Income (INR))
| Parameters for Normal Distribution | ||
|---|---|---|
| Parameter | Symbol | Estimate |
| Mean | Mu | 35250 |
| Std Dev | Sigma | 25835.26 |
| Goodness-of-Fit Tests for Normal Distribution | ||||
|---|---|---|---|---|
| Test | Statistic | p Value | ||
| Kolmogorov-Smirnov | D | 0.20386038 | Pr > D | 0.028 |
| Cramer-von Mises | W-Sq | 0.17272625 | Pr > W-Sq | 0.010 |
| Anderson-Darling | A-Sq | 1.01942059 | Pr > A-Sq | 0.009 |
| Quantiles for Normal Distribution | ||
|---|---|---|
| Percent | Quantile | |
| Observed | Estimated | |
| 1.0 | 9000.00 | -24851.80 |
| 5.0 | 10000.00 | -7245.22 |
| 10.0 | 11500.00 | 2140.79 |
| 25.0 | 14500.00 | 17824.38 |
| 50.0 | 28500.00 | 35250.00 |
| 75.0 | 48500.00 | 52675.62 |
| 90.0 | 78500.00 | 68359.21 |
| 95.0 | 91500.00 | 77745.22 |
| 99.0 | 98000.00 | 95351.80 |
The UNIVARIATE Procedure
Variable: Monthly_Savings (Monthly Savings (INR))
| Moments | |||
|---|---|---|---|
| N | 20 | Sum Weights | 20 |
| Mean | 5070 | Sum Observations | 101400 |
| Std Deviation | 4984.61845 | Variance | 24846421.1 |
| Skewness | 1.91792763 | Kurtosis | 3.66741326 |
| Uncorrected SS | 986180000 | Corrected SS | 472082000 |
| Coeff Variation | 98.3159457 | Std Error Mean | 1114.59457 |
| Basic Statistical Measures | |||
|---|---|---|---|
| Location | Variability | ||
| Mean | 5070.000 | Std Deviation | 4985 |
| Median | 3250.000 | Variance | 24846421 |
| Mode | 2000.000 | Range | 19500 |
| Interquartile Range | 4500 | ||
Note: The mode displayed is the smallest of 4 modes with a count of 2.
| Basic Confidence Limits Assuming Normality | |||
|---|---|---|---|
| Parameter | Estimate | 95% Confidence Limits | |
| Mean | 5070 | 2737 | 7403 |
| Std Deviation | 4985 | 3791 | 7280 |
| Variance | 24846421 | 14369819 | 53004112 |
| Tests for Location: Mu0=0 | ||||
|---|---|---|---|---|
| Test | Statistic | p Value | ||
| Student's t | t | 4.548739 | Pr > |t| | 0.0002 |
| Sign | M | 10 | Pr >= |M| | <.0001 |
| Signed Rank | S | 105 | Pr >= |S| | <.0001 |
| Quantiles (Definition 5) | |
|---|---|
| Level | Quantile |
| 100% Max | 20000 |
| 99% | 20000 |
| 95% | 17500 |
| 90% | 12500 |
| 75% Q3 | 6500 |
| 50% Median | 3250 |
| 25% Q1 | 2000 |
| 10% | 950 |
| 5% | 600 |
| 1% | 500 |
| 0% Min | 500 |
| Extreme Observations | |||
|---|---|---|---|
| Lowest | Highest | ||
| Value | Obs | Value | Obs |
| 500 | 9 | 7000 | 10 |
| 700 | 15 | 8000 | 3 |
| 1200 | 12 | 10000 | 20 |
| 1500 | 18 | 15000 | 1 |
| 2000 | 13 | 20000 | 16 |
The UNIVARIATE Procedure
Variable: Financial_Literacy (Financial Literacy Score (1-10))
| Moments | |||
|---|---|---|---|
| N | 20 | Sum Weights | 20 |
| Mean | 5.905 | Sum Observations | 118.1 |
| Std Deviation | 1.20414853 | Variance | 1.44997368 |
| Skewness | 0.06215618 | Kurtosis | -0.7142734 |
| Uncorrected SS | 724.93 | Corrected SS | 27.5495 |
| Coeff Variation | 20.3920158 | Std Error Mean | 0.2692558 |
| Basic Statistical Measures | |||
|---|---|---|---|
| Location | Variability | ||
| Mean | 5.905000 | Std Deviation | 1.20415 |
| Median | 5.900000 | Variance | 1.44997 |
| Mode | . | Range | 4.30000 |
| Interquartile Range | 1.85000 | ||
| Basic Confidence Limits Assuming Normality | |||
|---|---|---|---|
| Parameter | Estimate | 95% Confidence Limits | |
| Mean | 5.90500 | 5.34144 | 6.46856 |
| Std Deviation | 1.20415 | 0.91574 | 1.75875 |
| Variance | 1.44997 | 0.83859 | 3.09318 |
| Tests for Location: Mu0=0 | ||||
|---|---|---|---|---|
| Test | Statistic | p Value | ||
| Student's t | t | 21.93082 | Pr > |t| | <.0001 |
| Sign | M | 10 | Pr >= |M| | <.0001 |
| Signed Rank | S | 105 | Pr >= |S| | <.0001 |
| Quantiles (Definition 5) | |
|---|---|
| Level | Quantile |
| 100% Max | 8.10 |
| 99% | 8.10 |
| 95% | 7.95 |
| 90% | 7.60 |
| 75% Q3 | 6.80 |
| 50% Median | 5.90 |
| 25% Q1 | 4.95 |
| 10% | 4.30 |
| 5% | 3.95 |
| 1% | 3.80 |
| 0% Min | 3.80 |
| Extreme Observations | |||
|---|---|---|---|
| Lowest | Highest | ||
| Value | Obs | Value | Obs |
| 3.8 | 9 | 6.9 | 10 |
| 4.1 | 15 | 7.0 | 3 |
| 4.5 | 18 | 7.4 | 20 |
| 4.7 | 12 | 7.8 | 1 |
| 4.9 | 5 | 8.1 | 16 |
4) PROC SQL EXAMPLES
proc sql;
title 'Average Monthly Income by State';
create table avg_income_state as
select State, count(*) as N, round(mean(Monthly_Income),2) as Avg_Income,
round(sum(Monthly_Savings),2) as Total_Savings
from money_in_india
group by State
order by Avg_Income desc;
quit;
proc print;run;
Output:
| Obs | State | N | Avg_Income | Total_Savings |
|---|---|---|---|---|
| 1 | Haryana | 1 | 98000 | 20000 |
| 2 | Maharashtra | 1 | 85000 | 15000 |
| 3 | Goa | 1 | 72000 | 10000 |
| 4 | Karnataka | 1 | 60000 | 8000 |
| 5 | Telangana | 1 | 52000 | 7000 |
| 6 | Delhi | 1 | 45000 | 5000 |
| 7 | Tamil Nadu | 1 | 35000 | 6000 |
| 8 | Gujarat | 1 | 33000 | 3500 |
| 9 | Punjab | 1 | 30000 | 4000 |
| 10 | Andhra Pradesh | 1 | 29000 | 2500 |
| 11 | West Bengal | 1 | 28000 | 3000 |
| 12 | Assam | 1 | 26000 | 3000 |
| 13 | Kerala | 1 | 22000 | 4000 |
| 14 | Madhya Pradesh | 1 | 16000 | 2000 |
| 15 | Rajasthan | 1 | 15000 | 2500 |
| 16 | Odisha | 1 | 14000 | 1200 |
| 17 | Chhattisgarh | 1 | 13000 | 1500 |
| 18 | Uttar Pradesh | 1 | 12000 | 2000 |
| 19 | Jharkhand | 1 | 11000 | 700 |
| 20 | Bihar | 1 | 9000 | 500 |
proc sql;
create table digital_adoption as
select Urban_Rural,
mean(Digital_Share) as Avg_Digital_Share format=8.2,
mean(Cash_Share) as Avg_Cash_Share format=8.2,
mean(Financial_Literacy) as Avg_Fin_Lit format=8.2
from money_in_india
group by Urban_Rural;
quit;
proc print;run;
Output:
| Obs | Urban_Rural | Avg_Digital_Share | Avg_Cash_Share | Avg_Fin_Lit |
|---|---|---|---|---|
| 1 | Rural | 22.43 | 77.57 | 4.60 |
| 2 | Urban | 62.46 | 37.54 | 6.61 |
proc sql;
create table similar_income_pairs as
select a.HouseholdID as H1, b.HouseholdID as H2, a.Income_Tier,
a.Monthly_Income as Income1, b.Monthly_Income as Income2
from money_in_india a, money_in_india b
where a.Income_Tier = b.Income_Tier and a.HouseholdID < b.HouseholdID;
quit;
proc print;run;
Output:
| Obs | H1 | H2 | Income_Tier | Income1 | Income2 |
|---|---|---|---|---|---|
| 1 | HH001 | HH020 | Upper-Mid | 85000.00 | 72000.00 |
| 2 | HH001 | HH017 | Upper-Mid | 85000.00 | 30000.00 |
| 3 | HH001 | HH016 | Upper-Mid | 85000.00 | 98000.00 |
| 4 | HH001 | HH011 | Upper-Mid | 85000.00 | 33000.00 |
| 5 | HH001 | HH010 | Upper-Mid | 85000.00 | 52000.00 |
| 6 | HH001 | HH006 | Upper-Mid | 85000.00 | 35000.00 |
| 7 | HH001 | HH003 | Upper-Mid | 85000.00 | 60000.00 |
| 8 | HH001 | HH002 | Upper-Mid | 85000.00 | 45000.00 |
| 9 | HH002 | HH020 | Upper-Mid | 45000.00 | 72000.00 |
| 10 | HH002 | HH017 | Upper-Mid | 45000.00 | 30000.00 |
| 11 | HH002 | HH016 | Upper-Mid | 45000.00 | 98000.00 |
| 12 | HH002 | HH011 | Upper-Mid | 45000.00 | 33000.00 |
| 13 | HH002 | HH010 | Upper-Mid | 45000.00 | 52000.00 |
| 14 | HH002 | HH006 | Upper-Mid | 45000.00 | 35000.00 |
| 15 | HH002 | HH003 | Upper-Mid | 45000.00 | 60000.00 |
| 16 | HH003 | HH020 | Upper-Mid | 60000.00 | 72000.00 |
| 17 | HH003 | HH017 | Upper-Mid | 60000.00 | 30000.00 |
| 18 | HH003 | HH016 | Upper-Mid | 60000.00 | 98000.00 |
| 19 | HH003 | HH011 | Upper-Mid | 60000.00 | 33000.00 |
| 20 | HH003 | HH010 | Upper-Mid | 60000.00 | 52000.00 |
| 21 | HH003 | HH006 | Upper-Mid | 60000.00 | 35000.00 |
| 22 | HH004 | HH019 | Mid | 22000.00 | 29000.00 |
| 23 | HH004 | HH014 | Mid | 22000.00 | 26000.00 |
| 24 | HH004 | HH013 | Mid | 22000.00 | 16000.00 |
| 25 | HH004 | HH008 | Mid | 22000.00 | 15000.00 |
| 26 | HH004 | HH007 | Mid | 22000.00 | 28000.00 |
| 27 | HH005 | HH018 | Low | 12000.00 | 13000.00 |
| 28 | HH005 | HH015 | Low | 12000.00 | 11000.00 |
| 29 | HH005 | HH012 | Low | 12000.00 | 14000.00 |
| 30 | HH005 | HH009 | Low | 12000.00 | 9000.00 |
| 31 | HH006 | HH020 | Upper-Mid | 35000.00 | 72000.00 |
| 32 | HH006 | HH017 | Upper-Mid | 35000.00 | 30000.00 |
| 33 | HH006 | HH016 | Upper-Mid | 35000.00 | 98000.00 |
| 34 | HH006 | HH011 | Upper-Mid | 35000.00 | 33000.00 |
| 35 | HH006 | HH010 | Upper-Mid | 35000.00 | 52000.00 |
| 36 | HH007 | HH019 | Mid | 28000.00 | 29000.00 |
| 37 | HH007 | HH014 | Mid | 28000.00 | 26000.00 |
| 38 | HH007 | HH013 | Mid | 28000.00 | 16000.00 |
| 39 | HH007 | HH008 | Mid | 28000.00 | 15000.00 |
| 40 | HH008 | HH019 | Mid | 15000.00 | 29000.00 |
| 41 | HH008 | HH014 | Mid | 15000.00 | 26000.00 |
| 42 | HH008 | HH013 | Mid | 15000.00 | 16000.00 |
| 43 | HH009 | HH018 | Low | 9000.00 | 13000.00 |
| 44 | HH009 | HH015 | Low | 9000.00 | 11000.00 |
| 45 | HH009 | HH012 | Low | 9000.00 | 14000.00 |
| 46 | HH010 | HH020 | Upper-Mid | 52000.00 | 72000.00 |
| 47 | HH010 | HH017 | Upper-Mid | 52000.00 | 30000.00 |
| 48 | HH010 | HH016 | Upper-Mid | 52000.00 | 98000.00 |
| 49 | HH010 | HH011 | Upper-Mid | 52000.00 | 33000.00 |
| 50 | HH011 | HH020 | Upper-Mid | 33000.00 | 72000.00 |
| 51 | HH011 | HH017 | Upper-Mid | 33000.00 | 30000.00 |
| 52 | HH011 | HH016 | Upper-Mid | 33000.00 | 98000.00 |
| 53 | HH012 | HH018 | Low | 14000.00 | 13000.00 |
| 54 | HH012 | HH015 | Low | 14000.00 | 11000.00 |
| 55 | HH013 | HH019 | Mid | 16000.00 | 29000.00 |
| 56 | HH013 | HH014 | Mid | 16000.00 | 26000.00 |
| 57 | HH014 | HH019 | Mid | 26000.00 | 29000.00 |
| 58 | HH015 | HH018 | Low | 11000.00 | 13000.00 |
| 59 | HH016 | HH020 | Upper-Mid | 98000.00 | 72000.00 |
| 60 | HH016 | HH017 | Upper-Mid | 98000.00 | 30000.00 |
| 61 | HH017 | HH020 | Upper-Mid | 30000.00 | 72000.00 |
5) PROC REPORT, PROC TABULATE, TRANSPOSE
proc report data=avg_income_state nowd headline;
column State N Avg_Income Total_Savings;
define State / group 'State';
define N / 'Count';
define Avg_Income / analysis format=comma10.2 'Avg Income (INR)';
define Total_Savings / analysis format=comma12.2 'Total Savings (INR)';
run;
Output:
| State | Count | Avg Income (INR) | Total Savings (INR) |
|---|---|---|---|
| Andhra Pradesh | 1 | 29,000.00 | 2,500.00 |
| Assam | 1 | 26,000.00 | 3,000.00 |
| Bihar | 1 | 9,000.00 | 500.00 |
| Chhattisgarh | 1 | 13,000.00 | 1,500.00 |
| Delhi | 1 | 45,000.00 | 5,000.00 |
| Goa | 1 | 72,000.00 | 10,000.00 |
| Gujarat | 1 | 33,000.00 | 3,500.00 |
| Haryana | 1 | 98,000.00 | 20,000.00 |
| Jharkhand | 1 | 11,000.00 | 700.00 |
| Karnataka | 1 | 60,000.00 | 8,000.00 |
| Kerala | 1 | 22,000.00 | 4,000.00 |
| Madhya Pradesh | 1 | 16,000.00 | 2,000.00 |
| Maharashtra | 1 | 85,000.00 | 15,000.00 |
| Odisha | 1 | 14,000.00 | 1,200.00 |
| Punjab | 1 | 30,000.00 | 4,000.00 |
| Rajasthan | 1 | 15,000.00 | 2,500.00 |
| Tamil Nadu | 1 | 35,000.00 | 6,000.00 |
| Telangana | 1 | 52,000.00 | 7,000.00 |
| Uttar Pradesh | 1 | 12,000.00 | 2,000.00 |
| West Bengal | 1 | 28,000.00 | 3,000.00 |
proc tabulate data=money_in_india;
class Income_Tier Urban_Rural;
var Monthly_Income;
table Income_Tier all,
Urban_Rural*(Monthly_Income*(n mean*format=8.2));
keylabel n='Count' mean='Avg Income';
run;
Output:
| Urban_Rural | ||||
|---|---|---|---|---|
| Rural | Urban | |||
| Monthly Income (INR) | Monthly Income (INR) | |||
| Count | Avg Income | Count | Avg Income | |
| Income_Tier | 5 | 11800.00 | . | . |
| Low | ||||
| Mid | 2 | 15500.00 | 4 | 26250.00 |
| Upper-Mid | . | . | 9 | 56666.67 |
| All | 7 | 12857.14 | 13 | 47307.69 |
proc sort data=money_in_india out=_sorted;
by State;
run;
proc transpose data=_sorted out=trans_incomes prefix=Income_;
by State;
id HouseholdID;
var Monthly_Income;
run;
proc print;run;
Output:
| Obs | State | _NAME_ | _LABEL_ | Income_HH019 | Income_HH014 | Income_HH009 | Income_HH018 | Income_HH002 | Income_HH020 | Income_HH011 | Income_HH016 | Income_HH015 | Income_HH003 | Income_HH004 | Income_HH013 | Income_HH001 | Income_HH012 | Income_HH017 | Income_HH008 | Income_HH006 | Income_HH010 | Income_HH005 | Income_HH007 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Andhra Pradesh | Monthly_Income | Monthly Income (INR) | 29000.00 | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| 2 | Assam | Monthly_Income | Monthly Income (INR) | . | 26000.00 | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| 3 | Bihar | Monthly_Income | Monthly Income (INR) | . | . | 9000.00 | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| 4 | Chhattisgarh | Monthly_Income | Monthly Income (INR) | . | . | . | 13000.00 | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| 5 | Delhi | Monthly_Income | Monthly Income (INR) | . | . | . | . | 45000.00 | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| 6 | Goa | Monthly_Income | Monthly Income (INR) | . | . | . | . | . | 72000.00 | . | . | . | . | . | . | . | . | . | . | . | . | . | . |
| 7 | Gujarat | Monthly_Income | Monthly Income (INR) | . | . | . | . | . | . | 33000.00 | . | . | . | . | . | . | . | . | . | . | . | . | . |
| 8 | Haryana | Monthly_Income | Monthly Income (INR) | . | . | . | . | . | . | . | 98000.00 | . | . | . | . | . | . | . | . | . | . | . | . |
| 9 | Jharkhand | Monthly_Income | Monthly Income (INR) | . | . | . | . | . | . | . | . | 11000.00 | . | . | . | . | . | . | . | . | . | . | . |
| 10 | Karnataka | Monthly_Income | Monthly Income (INR) | . | . | . | . | . | . | . | . | . | 60000.00 | . | . | . | . | . | . | . | . | . | . |
| 11 | Kerala | Monthly_Income | Monthly Income (INR) | . | . | . | . | . | . | . | . | . | . | 22000.00 | . | . | . | . | . | . | . | . | . |
| 12 | Madhya Pradesh | Monthly_Income | Monthly Income (INR) | . | . | . | . | . | . | . | . | . | . | . | 16000.00 | . | . | . | . | . | . | . | . |
| 13 | Maharashtra | Monthly_Income | Monthly Income (INR) | . | . | . | . | . | . | . | . | . | . | . | . | 85000.00 | . | . | . | . | . | . | . |
| 14 | Odisha | Monthly_Income | Monthly Income (INR) | . | . | . | . | . | . | . | . | . | . | . | . | . | 14000.00 | . | . | . | . | . | . |
| 15 | Punjab | Monthly_Income | Monthly Income (INR) | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 30000.00 | . | . | . | . | . |
| 16 | Rajasthan | Monthly_Income | Monthly Income (INR) | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 15000.00 | . | . | . | . |
| 17 | Tamil Nadu | Monthly_Income | Monthly Income (INR) | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 35000.00 | . | . | . |
| 18 | Telangana | Monthly_Income | Monthly Income (INR) | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 52000.00 | . | . |
| 19 | Uttar Pradesh | Monthly_Income | Monthly Income (INR) | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 12000.00 | . |
| 20 | West Bengal | Monthly_Income | Monthly Income (INR) | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | . | 28000.00 |
6) MACROS — reusable reports and QC
%macro summary_by(categorical=);
%put NOTE: Running summary_by for &categorical.;
proc means data=money_in_india n mean median std min max;
class &categorical.;
var Monthly_Income Monthly_Savings Financial_Literacy;
run;
%mend summary_by;
%summary_by(categorical=Income_Tier)
Output:
The MEANS Procedure
| Income_Tier | N Obs | Variable | Label | N | Mean | Median | Std Dev | Minimum | Maximum |
|---|---|---|---|---|---|---|---|---|---|
| Low | 5 | Monthly_Income Monthly_Savings Financial_Literacy | Monthly Income (INR) Monthly Savings (INR) Financial Literacy Score (1-10) | 5 5 5 | 11800.00 1180.00 4.4000000 | 12000.00 1200.00 4.5000000 | 1923.54 605.8052492 0.4472136 | 9000.00 500.0000000 3.8000000 | 14000.00 2000.00 4.9000000 |
| Mid | 6 | Monthly_Income Monthly_Savings Financial_Literacy | Monthly Income (INR) Monthly Savings (INR) Financial Literacy Score (1-10) | 6 6 6 | 22666.67 2833.33 5.5833333 | 24000.00 2750.00 5.6500000 | 6055.30 683.1300511 0.4308906 | 15000.00 2000.00 5.0000000 | 29000.00 4000.00 6.2000000 |
| Upper-Mid | 9 | Monthly_Income Monthly_Savings Financial_Literacy | Monthly Income (INR) Monthly Savings (INR) Financial Literacy Score (1-10) | 9 9 9 | 56666.67 8722.22 6.9555556 | 52000.00 7000.00 6.9000000 | 24124.68 5506.31 0.7019813 | 30000.00 3500.00 6.0000000 | 98000.00 20000.00 8.1000000 |
%summary_by(categorical=Urban_Rural)
Output:
The MEANS Procedure
| Urban_Rural | N Obs | Variable | Label | N | Mean | Median | Std Dev | Minimum | Maximum |
|---|---|---|---|---|---|---|---|---|---|
| Rural | 7 | Monthly_Income Monthly_Savings Financial_Literacy | Monthly Income (INR) Monthly Savings (INR) Financial Literacy Score (1-10) | 7 7 7 | 12857.14 1485.71 4.6000000 | 13000.00 1500.00 4.7000000 | 2410.30 733.5497516 0.5033223 | 9000.00 500.0000000 3.8000000 | 16000.00 2500.00 5.2000000 |
| Urban | 13 | Monthly_Income Monthly_Savings Financial_Literacy | Monthly Income (INR) Monthly Savings (INR) Financial Literacy Score (1-10) | 13 13 13 | 47307.69 7000.00 6.6076923 | 35000.00 5000.00 6.4000000 | 24574.32 5248.02 0.8004806 | 22000.00 2500.00 5.6000000 | 98000.00 20000.00 8.1000000 |
%summary_by(categorical=Bank_Type)
Output:
The MEANS Procedure
| Bank_Type | N Obs | Variable | Label | N | Mean | Median | Std Dev | Minimum | Maximum |
|---|---|---|---|---|---|---|---|---|---|
| Cooperative | 5 | Monthly_Income Monthly_Savings Financial_Literacy | Monthly Income (INR) Monthly Savings (INR) Financial Literacy Score (1-10) | 5 5 5 | 14000.00 1840.00 4.8600000 | 14000.00 2000.00 4.9000000 | 1581.14 502.9910536 0.2701851 | 12000.00 1200.00 4.5000000 | 16000.00 2500.00 5.2000000 |
| No Bank | 2 | Monthly_Income Monthly_Savings Financial_Literacy | Monthly Income (INR) Monthly Savings (INR) Financial Literacy Score (1-10) | 2 2 2 | 10000.00 600.0000000 3.9500000 | 10000.00 600.0000000 3.9500000 | 1414.21 141.4213562 0.2121320 | 9000.00 500.0000000 3.8000000 | 11000.00 700.0000000 4.1000000 |
| Private Bank | 8 | Monthly_Income Monthly_Savings Financial_Literacy | Monthly Income (INR) Monthly Savings (INR) Financial Literacy Score (1-10) | 8 8 8 | 57375.00 8937.50 6.9250000 | 56000.00 7500.00 6.9500000 | 26272.95 5978.76 0.8614771 | 28000.00 2500.00 5.7000000 | 98000.00 20000.00 8.1000000 |
| Public Bank | 5 | Monthly_Income Monthly_Savings Financial_Literacy | Monthly Income (INR) Monthly Savings (INR) Financial Literacy Score (1-10) | 5 5 5 | 31200.00 3900.00 6.1000000 | 30000.00 4000.00 6.2000000 | 8757.85 741.6198487 0.3162278 | 22000.00 3000.00 5.6000000 | 45000.00 5000.00 6.4000000 |
%macro make_report(state=);
%put INFO: Creating report for &state.;
proc sql;
create table report_&state. as
select *
from money_in_india
where State = "&state.";
quit;
proc means data=report_&state. n mean std median;
var Monthly_Income Monthly_Savings Digital_Share;
run;
proc freq data=report_&state.;
tables Income_Tier Urban_Rural / nocum nopercent;
run;
%mend make_report;
%make_report(state=Maharashtra)
Output:
The MEANS Procedure
| Variable | Label | N | Mean | Std Dev | Median |
|---|---|---|---|---|---|
Monthly_Income Monthly_Savings Digital_Share | Monthly Income (INR) Monthly Savings (INR) Digital Share Percentage | 1 1 1 | 85000.00 15000.00 80.0000000 | . . . | 85000.00 15000.00 80.0000000 |
The FREQ Procedure
| Income_Tier | Frequency |
|---|---|
| Upper-Mid | 1 |
| Urban_Rural | Frequency |
|---|---|
| Urban | 1 |
%make_report(state=Kerala)
Output:
The MEANS Procedure
| Variable | Label | N | Mean | Std Dev | Median |
|---|---|---|---|---|---|
Monthly_Income Monthly_Savings Digital_Share | Monthly Income (INR) Monthly Savings (INR) Digital Share Percentage | 1 1 1 | 22000.00 4000.00 50.0000000 | . . . | 22000.00 4000.00 50.0000000 |
The FREQ Procedure
| Income_Tier | Frequency |
|---|---|
| Mid | 1 |
| Urban_Rural | Frequency |
|---|---|
| Urban | 1 |
7) QC / VALIDATION CHECKS
data qc_checks;
set money_in_india;
sum_share = Cash_Share + Digital_Share;
if missing(Cash_Share) or missing(Digital_Share) then flag_missing=1;
else flag_missing=0;
if abs(sum_share - 100) > 5 then flag_unbalanced=1;
else flag_unbalanced=0;
run;
proc print;run;
Output:
| Obs | HouseholdID | State | City | Urban_Rural | Income_Source | Bank_Type | Predominant_Expense | Monthly_Income | Monthly_Savings | Cash_Share | Digital_Share | Remittance_Amount | Financial_Literacy | Savings_Rate | Income_Tier | sum_share | flag_missing | flag_unbalanced |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | HH001 | Maharashtra | Mumbai | Urban | Salaried | Private Bank | Rent & Bills | 85000.00 | 15000.00 | 20.00 | 80.00 | 0.00 | 7.80 | 0.17647 | Upper-Mid | 100 | 0 | 0 |
| 2 | HH002 | Delhi | New Delhi | Urban | Salaried | Public Bank | Food | 45000.00 | 5000.00 | 30.00 | 70.00 | 0.00 | 6.40 | 0.11111 | Upper-Mid | 100 | 0 | 0 |
| 3 | HH003 | Karnataka | Bengaluru | Urban | Self-Employed | Private Bank | Education | 60000.00 | 8000.00 | 25.00 | 75.00 | 5000.00 | 7.00 | 0.13333 | Upper-Mid | 100 | 0 | 0 |
| 4 | HH004 | Kerala | Thiruvananthapuram | Urban | Pensioner | Public Bank | Healthcare | 22000.00 | 4000.00 | 50.00 | 50.00 | 10000.00 | 6.20 | 0.18182 | Mid | 100 | 0 | 0 |
| 5 | HH005 | Uttar Pradesh | Lucknow | Rural | Agriculture | Cooperative | Basic Needs | 12000.00 | 2000.00 | 80.00 | 20.00 | 2000.00 | 4.90 | 0.16667 | Low | 100 | 0 | 0 |
| 6 | HH006 | Tamil Nadu | Chennai | Urban | Salaried | Private Bank | Transport | 35000.00 | 6000.00 | 35.00 | 65.00 | 0.00 | 6.70 | 0.17143 | Upper-Mid | 100 | 0 | 0 |
| 7 | HH007 | West Bengal | Kolkata | Urban | Self-Employed | Private Bank | Food | 28000.00 | 3000.00 | 60.00 | 40.00 | 0.00 | 5.80 | 0.10714 | Mid | 100 | 0 | 0 |
| 8 | HH008 | Rajasthan | Jaipur | Rural | Agriculture | Cooperative | Utilities | 15000.00 | 2500.00 | 70.00 | 30.00 | 0.00 | 5.20 | 0.16667 | Mid | 100 | 0 | 0 |
| 9 | HH009 | Bihar | Patna | Rural | Labor | No Bank | Cash Expenses | 9000.00 | 500.00 | 90.00 | 10.00 | 0.00 | 3.80 | 0.05556 | Low | 100 | 0 | 0 |
| 10 | HH010 | Telangana | Hyderabad | Urban | Salaried | Private Bank | Entertainment | 52000.00 | 7000.00 | 30.00 | 70.00 | 0.00 | 6.90 | 0.13462 | Upper-Mid | 100 | 0 | 0 |
| 11 | HH011 | Gujarat | Ahmedabad | Urban | Self-Employed | Public Bank | Food | 33000.00 | 3500.00 | 45.00 | 55.00 | 0.00 | 6.00 | 0.10606 | Upper-Mid | 100 | 0 | 0 |
| 12 | HH012 | Odisha | Bhubaneswar | Rural | Agriculture | Cooperative | Basic Needs | 14000.00 | 1200.00 | 75.00 | 25.00 | 0.00 | 4.70 | 0.08571 | Low | 100 | 0 | 0 |
| 13 | HH013 | Madhya Pradesh | Bhopal | Rural | Agriculture | Cooperative | Education | 16000.00 | 2000.00 | 65.00 | 35.00 | 0.00 | 5.00 | 0.12500 | Mid | 100 | 0 | 0 |
| 14 | HH014 | Assam | Guwahati | Urban | Salaried | Public Bank | Transport | 26000.00 | 3000.00 | 40.00 | 60.00 | 0.00 | 5.60 | 0.11538 | Mid | 100 | 0 | 0 |
| 15 | HH015 | Jharkhand | Ranchi | Rural | Labor | No Bank | Cash Expenses | 11000.00 | 700.00 | 85.00 | 15.00 | 0.00 | 4.10 | 0.06364 | Low | 100 | 0 | 0 |
| 16 | HH016 | Haryana | Gurugram | Urban | Salaried | Private Bank | Rent & Bills | 98000.00 | 20000.00 | 22.00 | 78.00 | 0.00 | 8.10 | 0.20408 | Upper-Mid | 100 | 0 | 0 |
| 17 | HH017 | Punjab | Chandigarh | Urban | Pensioner | Public Bank | Healthcare | 30000.00 | 4000.00 | 48.00 | 52.00 | 0.00 | 6.30 | 0.13333 | Upper-Mid | 100 | 0 | 0 |
| 18 | HH018 | Chhattisgarh | Raipur | Rural | Agriculture | Cooperative | Basic Needs | 13000.00 | 1500.00 | 78.00 | 22.00 | 0.00 | 4.50 | 0.11538 | Low | 100 | 0 | 0 |
| 19 | HH019 | Andhra Pradesh | Vijayawada | Urban | Self-Employed | Private Bank | Education | 29000.00 | 2500.00 | 55.00 | 45.00 | 0.00 | 5.70 | 0.08621 | Mid | 100 | 0 | 0 |
| 20 | HH020 | Goa | Panaji | Urban | Tourism | Private Bank | Entertainment | 72000.00 | 10000.00 | 28.00 | 72.00 | 15000.00 | 7.40 | 0.13889 | Upper-Mid | 100 | 0 | 0 |
proc freq data=qc_checks;
tables flag_missing flag_unbalanced;
run;
Output:
The FREQ Procedure
| flag_missing | Frequency | Percent | Cumulative Frequency | Cumulative Percent |
|---|---|---|---|---|
| 0 | 20 | 100.00 | 20 | 100.00 |
| flag_unbalanced | Frequency | Percent | Cumulative Frequency | Cumulative Percent |
|---|---|---|---|---|
| 0 | 20 | 100.00 | 20 | 100.00 |
proc print data=qc_checks;
where flag_unbalanced=1 or flag_missing=1;
var HouseholdID State Cash_Share Digital_Share sum_share;
run;
Log:
8) ADVANCED PROC SQL + JOIN
data state_macro;
length State $20.;
input State :$20. Avg_State_Income Avg_Fin_Lit Rate_Digital;
datalines;
Maharashtra 65000 7.2 75
Delhi 54000 6.8 72
Karnataka 60000 6.9 70
Kerala 32000 6.3 68
Uttar Pradesh 15000 4.6 35
Tamil Nadu 42000 6.5 60
West Bengal 30000 5.7 50
Rajasthan 18000 4.9 40
Bihar 9000 3.6 20
Telangana 50000 6.8 68
Gujarat 40000 6.1 58
Odisha 16000 4.5 38
Madhya Pradesh 17000 4.8 36
Assam 25000 5.5 45
Jharkhand 11000 4.2 30
Haryana 70000 7.5 74
Punjab 35000 6.2 62
Chhattisgarh 14000 4.4 34
Andhra Pradesh 30000 5.9 55
Goa 68000 7.0 80
;
run;
proc print;run;
Output:
| Obs | State | Avg_State_Income | Avg_Fin_Lit | Rate_Digital |
|---|---|---|---|---|
| 1 | Maharashtra | 65000 | 7.2 | 75.0 |
| 2 | Delhi | 54000 | 6.8 | 72.0 |
| 3 | Karnataka | 60000 | 6.9 | 70.0 |
| 4 | Kerala | 32000 | 6.3 | 68.0 |
| 5 | Uttar | . | 15000.0 | 4.6 |
| 6 | Tamil | . | 42000.0 | 6.5 |
| 7 | West | . | 30000.0 | 5.7 |
| 8 | Rajasthan | 18000 | 4.9 | 40.0 |
| 9 | Bihar | 9000 | 3.6 | 20.0 |
| 10 | Telangana | 50000 | 6.8 | 68.0 |
| 11 | Gujarat | 40000 | 6.1 | 58.0 |
| 12 | Odisha | 16000 | 4.5 | 38.0 |
| 13 | Madhya | . | 17000.0 | 4.8 |
| 14 | Assam | 25000 | 5.5 | 45.0 |
| 15 | Jharkhand | 11000 | 4.2 | 30.0 |
| 16 | Haryana | 70000 | 7.5 | 74.0 |
| 17 | Punjab | 35000 | 6.2 | 62.0 |
| 18 | Chhattisgarh | 14000 | 4.4 | 34.0 |
| 19 | Andhra | . | 30000.0 | 5.9 |
| 20 | Goa | 68000 | 7.0 | 80.0 |
proc sql;
create table household_macro as
select a.*, b.Avg_State_Income, b.Avg_Fin_Lit, b.Rate_Digital
from money_in_india a left join state_macro b
on a.State = b.State;
quit;
proc print;
run;
proc sql;
create table below_state_avg as
select HouseholdID, State, Monthly_Income, Avg_State_Income
from household_macro
where Monthly_Income < Avg_State_Income
order by State, Monthly_Income;
quit;
proc print data=below_state_avg; run;
Output:
| Obs | HouseholdID | State | Monthly_Income | Avg_State_Income |
|---|---|---|---|---|
| 1 | HH018 | Chhattisgarh | 13000.00 | 14000 |
| 2 | HH002 | Delhi | 45000.00 | 54000 |
| 3 | HH011 | Gujarat | 33000.00 | 40000 |
| 4 | HH004 | Kerala | 22000.00 | 32000 |
| 5 | HH012 | Odisha | 14000.00 | 16000 |
| 6 | HH017 | Punjab | 30000.00 | 35000 |
| 7 | HH008 | Rajasthan | 15000.00 | 18000 |
9) BASIC VISUALIZATION (requires SAS ODS Graphics)
ods graphics on;
proc sgplot data=money_in_india;
vbar Income_Tier / response=Monthly_Income stat=mean;
title 'Average Monthly Income by Income Tier';
run;
ods graphics off;
Output:
10) SAVING RESULTS and CLEANUP
proc datasets library=work;
save avg_income_state digital_adoption household_macro;
quit;
Output:
| Directory | |
|---|---|
| Libref | WORK |
| Engine | V9 |
| Physical Name | /saswork/SAS_workB994000181B7_odaws01-apse1-2.oda.sas.com/SAS_work1C21000181B7_odaws01-apse1-2.oda.sas.com |
| Filename | /saswork/SAS_workB994000181B7_odaws01-apse1-2.oda.sas.com/SAS_work1C21000181B7_odaws01-apse1-2.oda.sas.com |
| Inode Number | 1081511 |
| Access Permission | rwx------ |
| Owner Name | u63247146 |
| File Size | 4KB |
| File Size (bytes) | 4096 |
| # | Name | Member Type | File Size | Last Modified |
|---|---|---|---|---|
| 1 | AVG_INCOME_STATE | DATA | 256KB | 08/19/2025 12:39:33 |
| 2 | BELOW_STATE_AVG | DATA | 256KB | 08/19/2025 12:57:37 |
| 3 | DIGITAL_ADOPTION | DATA | 256KB | 08/19/2025 12:55:21 |
| 4 | FORMATS | CATALOG | 24KB | 08/19/2025 12:32:48 |
| 5 | HOUSEHOLD_MACRO | DATA | 256KB | 08/19/2025 12:57:37 |
| 6 | MONEY_IN_INDIA | DATA | 384KB | 08/19/2025 12:55:21 |
| 7 | QC_CHECKS | DATA | 256KB | 08/19/2025 12:54:12 |
| 8 | REGSTRY | ITEMSTOR | 32KB | 08/19/2025 12:04:25 |
| 9 | REPORT_KERALA | DATA | 256KB | 08/19/2025 12:55:21 |
| 10 | REPORT_MAHARASHTRA | DATA | 256KB | 08/19/2025 12:55:21 |
| 11 | SASGOPT | CATALOG | 12KB | 08/19/2025 12:04:25 |
| 12 | SASMAC1 | CATALOG | 212KB | 08/19/2025 12:04:25 |
| 13 | SASMAC2 | CATALOG | 20KB | 08/19/2025 12:58:06 |
| 14 | SASMAC3 | CATALOG | 20KB | 08/19/2025 12:04:25 |
| 15 | SASMAC4 | CATALOG | 20KB | 08/19/2025 12:58:35 |
| 16 | SASMAC5 | CATALOG | 20KB | 08/19/2025 12:04:25 |
| 17 | SASMAC6 | CATALOG | 20KB | 08/19/2025 12:04:25 |
| 18 | SASMAC7 | CATALOG | 20KB | 08/19/2025 12:04:25 |
| 19 | SASMAC8 | CATALOG | 20KB | 08/19/2025 12:04:25 |
| 20 | SASMAC9 | CATALOG | 20KB | 08/19/2025 12:04:25 |
| 21 | SASMACR | CATALOG | 20KB | 08/19/2025 12:58:06 |
| 22 | SIMILAR_INCOME_PAIRS | DATA | 256KB | 08/19/2025 12:55:21 |
| 23 | STATE_MACRO | DATA | 256KB | 08/19/2025 12:57:01 |
| 24 | TRANS_INCOMES | DATA | 256KB | 08/19/2025 12:55:21 |
| 25 | _SORTED | DATA | 256KB | 08/19/2025 12:55:21 |
Comments
Post a Comment