Advertisement
Guest User

Untitled

a guest
Nov 27th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SAS 1.27 KB | None | 0 0
  1. /* ALL OKLAHOMA */
  2.  
  3. /* CALCULATE PROPORTION OF LOW INCOME FAMILIES */
  4.  
  5. /* Get data with households that house a single family */
  6. DATA singlefamilyhhtokl;
  7. SET project.g6oklcol;
  8. IF state=40;
  9. IF hht=1 or hht=2 or hht=3;
  10. run;
  11. /*Total Number of Rows = 45568 */
  12.  
  13. proc sql;
  14. select puma1, count(*) as N_Obs
  15. from singlefamilyhhtokl
  16. group by puma1;
  17. quit;
  18.  
  19. /*median of single family household*/
  20. PROC MEANS data=singlefamilyhhtokl(where=(persons=4)) median noprint;
  21. class puma1;
  22. var hinc;
  23. weight hweight;
  24. output out = test median= med;
  25. run;
  26. proc print data=test;
  27. run;
  28.  
  29.  
  30. /*Get count of low income households based on listed conditions*/
  31. proc sql;
  32. select count(*) as N_Obs
  33. from singlefamilyhhtokl
  34. where persons=4 and hinc<.8*(42900)
  35. or
  36. persons=3 and hinc< .9*(.8*(42900))
  37. or
  38. persons=2 and hinc< .8*(.8*(42900))
  39. or
  40. persons=5 and hinc< 1.08*(.8*(42900))
  41. or
  42. persons=6 and hinc< 1.16*(.8*(42900))
  43. and
  44. puma1=40100;
  45. quit;
  46.  
  47. /*N_Obs =15698*/
  48.  
  49. /*Proportion : 15698/9228 = */
  50.  
  51. proc sql;
  52. select count(*) as N_Obs
  53. from singlefamilyhhtokl
  54. where persons=4 and hinc<.8*(49000)
  55. or
  56. persons=3 and hinc< .9*(.8*(49000))
  57. or
  58. persons=2 and hinc< .8*(.8*(49000))
  59. or
  60. persons=5 and hinc< 1.08*(.8*(49000))
  61. or
  62. persons=6 and hinc< 1.16*(.8*(49000))
  63. and
  64. puma1=40201;
  65. quit;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement