Advertisement
Guest User

Untitled

a guest
Nov 24th, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SAS 6.60 KB | None | 0 0
  1. /* ALL NEW JERSEY */
  2. /* Get the summary statistics */
  3. PROC MEANS DATA=PROJECT.gnj mean median n stddev min max;
  4. var finc hinc ;
  5. run;
  6.  
  7. /* CALCULATE PROPORTION OF LOW INCOME FAMILIES */
  8. /* Get data with households that house a single family */
  9. DATA singlefamilyhht;
  10. SET project.gnj;
  11. IF hht=1;
  12. run;
  13. /*Total Number of Rows = 83267 */
  14.  
  15. /*median of single family household*/
  16. PROC MEANS data=singlefamilyhht(where= (persons=4)) median;
  17. var hinc;
  18. weight hweight;
  19. run;
  20. /*Note median =82300.00*/
  21.  
  22.  
  23. /*Get count of low income households based on listed conditions*/
  24. proc sql;
  25. select count(*) as N_Obs
  26. from singlefamilyhht
  27. where persons=4 and hinc<.8*(82300)
  28. or
  29. persons=3 and hinc< .9*(.8*(82300))
  30. or
  31.  persons=2 and hinc< .8*(.8*(82300))
  32. or
  33.  persons=5 and hinc< 1.08*(.8*(82300))
  34. or
  35. persons=6 and hinc< 1.16*(.8*(82300));
  36. quit;
  37. /*N_Obs =29942*/
  38.  
  39. /*Proportion : 29942/83267 = .35959 */
  40.  
  41.  
  42. /* CALCULATE PROPORTION OF LOW INCOME, AFFORDABLE, AND NOT CROWDED AMONG NEW UNITS  */
  43. DATA newunits;
  44. SET project.gnj;
  45. IF yrbuilt=1
  46. or
  47. yrbuilt=2
  48. or
  49. yrbuilt=3;
  50. run;
  51. /*Total Number of Rows = 15275*/
  52.  
  53.  
  54. /*Get count of low income households based on listed conditions*/
  55. proc sql;
  56. select count(*) as N_Obs
  57. from newunits
  58. where
  59. (persons=4 and hinc<.8*(82300)
  60. or
  61. persons=3 and hinc< .9*(.8*(82300))
  62. or
  63.  persons=2 and hinc< .8*(.8*(82300))
  64. or
  65.  persons=5 and hinc< 1.08*(.8*(82300))
  66. or
  67. persons=6 and hinc< 1.16*(.8*(82300))
  68. )
  69. and
  70. persons <= rooms
  71. and
  72. (smocapi<= 30 or grapi<=30);
  73. quit;
  74. /*N_Obs =3567*/
  75.  
  76. /*Proportion : 3567/15275 = .233519 */
  77.  
  78. /* CALCULATE PROPORTION OF AFFORDABLE AND NOT CROWDED AMONG NEW UNITS OCCUPIED BY LOW INCOME FAMILIES */
  79.  
  80. DATA NULI;
  81. SET project.gnj;
  82. where (yrbuilt=1
  83. or
  84. yrbuilt=2
  85. or
  86. yrbuilt=3)
  87. and
  88. (persons=4 and hinc<.8*(82300)
  89. or
  90. persons=3 and hinc< .9*(.8*(82300))
  91. or
  92.  persons=2 and hinc< .8*(.8*(82300))
  93. or
  94.  persons=5 and hinc< 1.08*(.8*(82300))
  95. or
  96. persons=6 and hinc< 1.16*(.8*(82300))
  97. );
  98. run;
  99. /*Total Number of Rows = 3843*/
  100.  
  101.  
  102. /*Get count of low income households based on listed conditions*/
  103. proc sql;
  104. select count(*) as N_Obs
  105. from NULI
  106. where
  107. persons <= rooms
  108. and
  109. (smocapi<= 30 or grapi<=30);
  110. quit;
  111. /*N_Obs =3567*/
  112.  
  113. /*Proportion : 3567/3843 = .92818 */
  114.  
  115. /* ALL OKLAHOMA */
  116. DATA oklahoma;
  117. SET project.g6oklcol;
  118. IF state=40;
  119. run;
  120. /*Total Number of Rows = 63590 */
  121.  
  122. /* CALCULATE PROPORTION OF LOW INCOME FAMILIES */
  123. /* Get data with households that house a single family */
  124. DATA singlefamilyhht2;
  125. SET oklahoma;
  126. IF hht=1;
  127. run;
  128. /*Total Number of Rows = 36434 */
  129.  
  130. /*median of single family household*/
  131. PROC MEANS data=singlefamilyhht2(where= (persons=4)) median;
  132. var hinc;
  133. weight hweight;
  134. run;
  135. /*Note median =51000*/
  136.  
  137. /*Get count of low income households based on listed conditions*/
  138. proc sql;
  139. select count(*) as N_Obs
  140. from singlefamilyhht2
  141. where persons=4 and hinc<.8*(51000)
  142. or
  143. persons=3 and hinc< .9*(.8*(51000))
  144. or
  145.  persons=2 and hinc< .8*(.8*(51000))
  146. or
  147.  persons=5 and hinc< 1.08*(.8*(51000))
  148. or
  149. persons=6 and hinc< 1.16*(.8*(51000));
  150. quit;
  151. /*N_Obs =13812*/
  152.  
  153. /*Proportion : 13812/36434 = .379096 */
  154.  
  155.  
  156. /* CALCULATE PROPORTION OF LOW INCOME, AFFORDABLE, AND NOT CROWDED AMONG NEW UNITS  */
  157. DATA newunits2;
  158. SET oklahoma;
  159. IF yrbuilt=1
  160. or
  161. yrbuilt=2
  162. or
  163. yrbuilt=3;
  164. run;
  165. /*Total Number of Rows = 8827*/
  166.  
  167.  
  168. /*Get count of low income households based on listed conditions*/
  169. proc sql;
  170. select count(*) as N_Obs
  171. from newunits2
  172. where
  173. (persons=4 and hinc<.8*(51000)
  174. or
  175. persons=3 and hinc< .9*(.8*(51000))
  176. or
  177.  persons=2 and hinc< .8*(.8*(51000))
  178. or
  179.  persons=5 and hinc< 1.08*(.8*(51000))
  180. or
  181. persons=6 and hinc< 1.16*(.8*(51000))
  182. )
  183. and
  184. persons <= rooms
  185. and
  186. (smocapi<= 30 or grapi<=30);
  187. quit;
  188. /*N_Obs =2539*/
  189.  
  190. /*Proportion : 2539/8827 = .28764 */
  191.  
  192. /* CALCULATE PROPORTION OF AFFORDABLE AND NOT CROWDED AMONG NEW UNITS OCCUPIED BY LOW INCOME FAMILIES */
  193.  
  194. DATA NULI2;
  195. SET oklahoma;
  196. where (yrbuilt=1
  197. or
  198. yrbuilt=2
  199. or
  200. yrbuilt=3)
  201. and
  202. (persons=4 and hinc<.8*(51000)
  203. or
  204. persons=3 and hinc< .9*(.8*(51000))
  205. or
  206.  persons=2 and hinc< .8*(.8*(51000))
  207. or
  208.  persons=5 and hinc< 1.08*(.8*(51000))
  209. or
  210. persons=6 and hinc< 1.16*(.8*(51000))
  211. );
  212. run;
  213. /*Total Number of Rows = 2702*/
  214.  
  215.  
  216. /*Get count of low income households based on listed conditions*/
  217. proc sql;
  218. select count(*) as N_Obs
  219. from NULI2
  220. where
  221. persons <= rooms
  222. and
  223. (smocapi<= 30 or grapi<=30);
  224. quit;
  225. /*N_Obs =2539*/
  226.  
  227. /*Proportion : 2539/2702 = .939674 */
  228.  
  229. /* ALL COLORADO */
  230. DATA colorado;
  231. SET project.g6oklcol;
  232. IF state=8;
  233. run;
  234. /*Total Number of Rows = 80732 */
  235.  
  236. /* CALCULATE PROPORTION OF LOW INCOME FAMILIES */
  237. /* Get data with households that house a single family */
  238. DATA singlefamilyhht3;
  239. SET colorado;
  240. IF hht=1;
  241. run;
  242. /*Total Number of Rows = 43420 */
  243.  
  244. /*median of single family household*/
  245. PROC MEANS data=singlefamilyhht3(where= (persons=4)) median;
  246. var hinc;
  247. weight hweight;
  248. run;
  249. /*Note median =68100*/
  250.  
  251. /*Get count of low income households based on listed conditions*/
  252. proc sql;
  253. select count(*) as N_Obs
  254. from singlefamilyhht3
  255. where persons=4 and hinc<.8*(68100)
  256. or
  257. persons=3 and hinc< .9*(.8*(68100))
  258. or
  259.  persons=2 and hinc< .8*(.8*(68100))
  260. or
  261.  persons=5 and hinc< 1.08*(.8*(68100))
  262. or
  263. persons=6 and hinc< 1.16*(.8*(68100));
  264. quit;
  265. /*N_Obs =15516*/
  266.  
  267. /*Proportion : 15516/43420 = .35735 */
  268.  
  269.  
  270. /* CALCULATE PROPORTION OF LOW INCOME, AFFORDABLE, AND NOT CROWDED AMONG NEW UNITS  */
  271. DATA newunits3;
  272. SET colorado;
  273. IF yrbuilt=1
  274. or
  275. yrbuilt=2
  276. or
  277. yrbuilt=3;
  278. run;
  279. /*Total Number of Rows = 17020*/
  280.  
  281.  
  282. /*Get count of low income households based on listed conditions*/
  283. proc sql;
  284. select count(*) as N_Obs
  285. from newunits3
  286. where
  287. (persons=4 and hinc<.8*(68100)
  288. or
  289. persons=3 and hinc< .9*(.8*(68100))
  290. or
  291.  persons=2 and hinc< .8*(.8*(68100))
  292. or
  293.  persons=5 and hinc< 1.08*(.8*(68100))
  294. or
  295. persons=6 and hinc< 1.16*(.8*(68100))
  296. )
  297. and
  298. persons <= rooms
  299. and
  300. (smocapi<= 30 or grapi<=30);
  301. quit;
  302. /*N_Obs =4010*/
  303.  
  304. /*Proportion : 4010/17020 = .23561 */
  305.  
  306. /* CALCULATE PROPORTION OF AFFORDABLE AND NOT CROWDED AMONG NEW UNITS OCCUPIED BY LOW INCOME FAMILIES */
  307.  
  308. DATA NULI3;
  309. SET colorado;
  310. where (yrbuilt=1
  311. or
  312. yrbuilt=2
  313. or
  314. yrbuilt=3)
  315. and
  316. (persons=4 and hinc<.8*(68100)
  317. or
  318. persons=3 and hinc< .9*(.8*(68100))
  319. or
  320.  persons=2 and hinc< .8*(.8*(68100))
  321. or
  322.  persons=5 and hinc< 1.08*(.8*(68100))
  323. or
  324. persons=6 and hinc< 1.16*(.8*(68100))
  325. );
  326. run;
  327. /*Total Number of Rows = 4340*/
  328.  
  329.  
  330. /*Get count of low income households based on listed conditions*/
  331. proc sql;
  332. select count(*) as N_Obs
  333. from NULI3
  334. where
  335. persons <= rooms
  336. and
  337. (smocapi<= 30 or grapi<=30);
  338. quit;
  339. /*N_Obs =3793*/
  340.  
  341. /*Proportion : 4010/4340 = .92396 */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement