How to create an index of the funded share to population share
a. How do I create a variable for the ratio of each state’s population to total US population. Consider the variable name "Popshare".
b. How do I create a variable that has the ratio of total funded-amnt by state divided by total funded_amnt across all observations. Consider the variable name "Loanshare"
c. How do I put both of these share variables by state in one dataset, and divide loanshare by popshare.
By Using above datasets I wanted to find following
1. How many states have ratios of > 1
2. Which state has the highest ratio
Do you have some data to work with? If so post it to get a code answer
Here's an approach to create the pieces you will need. Presumably you can take care of the data manipulation steps.
proc summary data=have;
class state;
var population funded_amt;
output out=stats (drop=_freq_) sum=state_population state_funded_amt;
run;
data next_step;
if _n_=1 then do;
set stats (where=(_type_=0) rename=(state_population=total_population state_funded_amt=total_funded_amt));
end;
set stats (where=(_type_=1));
drop _type_;
run;
Actually I'm not able to understand the code
proc summary data=have;
class state; -------------> Why We use this
var population funded_amt; ------------> Do we need to create new variable named Population(Getting error that variable Population Not Found)
output out=stats (drop=_freq_) sum=state_population state_funded_amt; ---------> This is difficult for me to understand
run;
Due to this I'm not able to move further. Please do the needful. Waiting for your replay.
PROC SUMMARY is something that you will use every week. You need to learn it. Here's a link:
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.