Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data step1;
- set Rep2.overall;
- where hht = 1 and persons = 4;
- keep state lhinc hinc persons;
- run;
- proc sort;
- by state;
- run;
- Proc Means Data=step1 chartype Median Mean MAx;
- by state;
- Var HINC;
- output out = c;
- Run;
- data Step2;
- input state median;
- datalines;
- 8 65800.00
- 34 82500.00
- 40 48405.00
- ;
- data Step3;
- set Step2;
- fourp = .8*median;
- threep = .9*.8*median;
- twop = .8*.8*median;
- fivep = 1.08*.8*median;
- sixp = 1.16*.8*median;
- run;
- data step4;
- set rep2.overall;
- if hht ne 1 then delete;
- keep state persons hinc hht;
- run;
- proc sort;
- by state;
- run;
- data step4;
- merge step3 step4;
- by state;
- run;
- data step5;
- set step4;
- low_income = 0;
- if persons = 2 and hinc < twop then low_income = 1;
- if persons = 3 and hinc < threep then low_income = 1;
- if persons = 4 and hinc < fourp then low_income = 1;
- if persons = 5 and hinc < fivep then low_income = 1;
- if persons = 6 and hinc < sixp then low_income = 1;
- count = 1;
- run;
- Proc sql;
- Create table Step6 as
- Select state, SUM(low_income) AS low_income, sum(count) as total
- From Step5
- group by state
- ;
- Proc sql;
- Create table Step7 as
- Select *, low_income/total as ratio
- From Step6
- ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement