Advertisement
Guest User

Untitled

a guest
Nov 24th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SAS 6.93 KB | None | 0 0
  1. /* ALL NEW JERSEY */
  2.  
  3. /* CALCULATE PROPORTION OF LOW INCOME FAMILIES */
  4.  
  5. /* Get data with households that house a single family */
  6. DATA singlefamilyhht;
  7. SET project.gnj;
  8. IF hht=1 or hht=2 or hht=3;
  9. run;
  10. /*Total Number of Rows = 107529 */
  11.  
  12. /*median of single family household*/
  13. PROC MEANS data=singlefamilyhht(where=(persons=4)) median;
  14. var hinc;
  15. weight hweight;
  16. run;
  17. /*Note median =76000.00*/
  18.  
  19. /*Get count of low income households based on listed conditions*/
  20. proc sql;
  21. select count(*) as N_Obs
  22. from singlefamilyhht
  23. where persons=4 and hinc<.8*(76000)
  24. or
  25. persons=3 and hinc< .9*(.8*(76000))
  26. or
  27.  persons=2 and hinc< .8*(.8*(76000))
  28. or
  29.  persons=5 and hinc< 1.08*(.8*(76000))
  30. or
  31. persons=6 and hinc< 1.16*(.8*(76000));
  32. quit;
  33. /*N_Obs =41468*/
  34.  
  35. /*Proportion : 41468/107529 = .38564 */
  36.  
  37.  
  38. /* CALCULATE PROPORTION OF LOW INCOME, AFFORDABLE, AND NOT CROWDED AMONG NEW UNITS  */
  39. DATA newunits;
  40. SET project.gnj;
  41. IF yrbuilt=1
  42. or
  43. yrbuilt=2
  44. or
  45. yrbuilt=3;
  46. run;
  47. /*Total Number of Rows = 15275*/
  48.  
  49.  
  50. /*Get count of low income households based on listed conditions*/
  51. proc sql;
  52. select count(*) as N_Obs
  53. from newunits
  54. where
  55. ((hht=1 or hht=2 or hht=3)
  56. and persons=4 and hinc<.8*(76000)
  57. or
  58. persons=3 and hinc< .9*(.8*(76000))
  59. or
  60.  persons=2 and hinc< .8*(.8*(76000))
  61. or
  62.  persons=5 and hinc< 1.08*(.8*(76000))
  63. or
  64. persons=6 and hinc< 1.16*(.8*(76000))
  65. )
  66. and
  67. persons <= rooms
  68. and
  69. (smocapi<= 30 or grapi<=30);
  70. quit;
  71.  
  72. /*N_Obs =3124*/
  73.  
  74. /*Proportion : 3124/15275 = .20452 */
  75.  
  76. /* CALCULATE PROPORTION OF AFFORDABLE AND NOT CROWDED AMONG NEW UNITS OCCUPIED BY LOW INCOME FAMILIES */
  77.  
  78. DATA NULI;
  79. SET project.gnj;
  80. where (yrbuilt=1
  81. or
  82. yrbuilt=2
  83. or
  84. yrbuilt=3)
  85. and
  86. ((hht=1 or hht=2 or hht=3)
  87. and
  88. persons=4 and hinc<.8*(76000)
  89. or
  90. persons=3 and hinc< .9*(.8*(76000))
  91. or
  92.  persons=2 and hinc< .8*(.8*(76000))
  93. or
  94.  persons=5 and hinc< 1.08*(.8*(76000))
  95. or
  96. persons=6 and hinc< 1.16*(.8*(76000))
  97. );
  98. run;
  99. /*Total Number of Rows = 3386*/
  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 =3124*/
  112.  
  113. /*Proportion : 3124/3386 = .92262*/
  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 or hht=2 or hht=3;
  127. run;
  128. /*Total Number of Rows = 45568 */
  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 =47000*/
  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*(47000)
  142. or
  143. persons=3 and hinc< .9*(.8*(47000))
  144. or
  145.  persons=2 and hinc< .8*(.8*(47000))
  146. or
  147.  persons=5 and hinc< 1.08*(.8*(47000))
  148. or
  149. persons=6 and hinc< 1.16*(.8*(47000));
  150. quit;
  151. /*N_Obs =13812*/
  152.  
  153. /*Proportion : 18274/45568 = .4010 */
  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. ((hht=1 or hht=2 or hht=3)
  174. and
  175. persons=4 and hinc<.8*(47000)
  176. or
  177. persons=3 and hinc< .9*(.8*(47000))
  178. or
  179.  persons=2 and hinc< .8*(.8*(47000))
  180. or
  181.  persons=5 and hinc< 1.08*(.8*(47000))
  182. or
  183. persons=6 and hinc< 1.16*(.8*(47000))
  184. )
  185. and
  186. persons <= rooms
  187. and
  188. (smocapi<= 30 or grapi<=30);
  189. quit;
  190. /*N_Obs =2240*/
  191.  
  192. /*Proportion : 2240/8827 = .25377 */
  193.  
  194. /* CALCULATE PROPORTION OF AFFORDABLE AND NOT CROWDED AMONG NEW UNITS OCCUPIED BY LOW INCOME FAMILIES */
  195.  
  196. DATA NULI2;
  197. SET oklahoma;
  198. where (yrbuilt=1
  199. or
  200. yrbuilt=2
  201. or
  202. yrbuilt=3)
  203. and
  204. ((hht=1 or hht=2 or hht=3)
  205. and persons=4 and hinc<.8*(47000)
  206. or
  207. persons=3 and hinc< .9*(.8*(47000))
  208. or
  209.  persons=2 and hinc< .8*(.8*(47000))
  210. or
  211.  persons=5 and hinc< 1.08*(.8*(47000))
  212. or
  213. persons=6 and hinc< 1.16*(.8*(47000))
  214. );
  215. run;
  216. /*Total Number of Rows = 2386*/
  217.  
  218.  
  219. /*Get count of low income households based on listed conditions*/
  220. proc sql;
  221. select count(*) as N_Obs
  222. from NULI2
  223. where
  224. persons <= rooms
  225. and
  226. (smocapi<= 30 or grapi<=30);
  227. quit;
  228. /*N_Obs =2240*/
  229.  
  230. /*Proportion : 2240/2386 = .9388 */
  231.  
  232. /* ALL COLORADO */
  233. DATA colorado;
  234. SET project.g6oklcol;
  235. IF state=8;
  236. run;
  237. /*Total Number of Rows = 80732 */
  238.  
  239. /* CALCULATE PROPORTION OF LOW INCOME FAMILIES */
  240. /* Get data with households that house a single family */
  241. DATA singlefamilyhht3;
  242. SET colorado;
  243. IF hht=1 or hht=2 or hht=3;
  244. run;
  245. /*Total Number of Rows = 54168 */
  246.  
  247. /*median of single family household*/
  248. PROC MEANS data=singlefamilyhht3(where= (persons=4)) median;
  249. var hinc;
  250. weight hweight;
  251. run;
  252. /*Note median =63500.00*/
  253.  
  254. /*Get count of low income households based on listed conditions*/
  255. proc sql;
  256. select count(*) as N_Obs
  257. from singlefamilyhht3
  258. where
  259. (hht=1 or hht=2 or hht=3)
  260. and
  261. persons=4 and hinc<.8*(63500)
  262. or
  263. persons=3 and hinc< .9*(.8*(63500))
  264. or
  265.  persons=2 and hinc< .8*(.8*(63500))
  266. or
  267.  persons=5 and hinc< 1.08*(.8*(63500))
  268. or
  269. persons=6 and hinc< 1.16*(.8*(63500));
  270. quit;
  271. /*N_Obs =20617*/
  272.  
  273. /*Proportion : 15516/54168 = .28644 */
  274.  
  275.  
  276. /* CALCULATE PROPORTION OF LOW INCOME, AFFORDABLE, AND NOT CROWDED AMONG NEW UNITS  */
  277. DATA newunits3;
  278. SET colorado;
  279. IF yrbuilt=1
  280. or
  281. yrbuilt=2
  282. or
  283. yrbuilt=3;
  284. run;
  285. /*Total Number of Rows = 17020*/
  286.  
  287.  
  288. /*Get count of low income households based on listed conditions*/
  289. proc sql;
  290. select count(*) as N_Obs
  291. from newunits3
  292. where
  293. ((hht=1 or hht=2 or hht=3)
  294. and persons=4 and hinc<.8*(63500)
  295. or
  296. persons=3 and hinc< .9*(.8*(63500))
  297. or
  298.  persons=2 and hinc< .8*(.8*(63500))
  299. or
  300.  persons=5 and hinc< 1.08*(.8*(63500))
  301. or
  302. persons=6 and hinc< 1.16*(.8*(63500))
  303. )
  304. and
  305. persons <= rooms
  306. and
  307. (smocapi<= 30 or grapi<=30);
  308. quit;
  309. /*N_Obs =3515*/
  310.  
  311. /*Proportion : 3515/17020 = .20652 */
  312.  
  313. /* CALCULATE PROPORTION OF AFFORDABLE AND NOT CROWDED AMONG NEW UNITS OCCUPIED BY LOW INCOME FAMILIES */
  314.  
  315. DATA NULI3;
  316. SET colorado;
  317. where (yrbuilt=1
  318. or
  319. yrbuilt=2
  320. or
  321. yrbuilt=3)
  322. and
  323. ((hht=1 or hht=2 or hht=3)
  324. and persons=4 and hinc<.8*(63500)
  325. or
  326. persons=3 and hinc< .9*(.8*(63500))
  327. or
  328.  persons=2 and hinc< .8*(.8*(63500))
  329. or
  330.  persons=5 and hinc< 1.08*(.8*(63500))
  331. or
  332. persons=6 and hinc< 1.16*(.8*(63500))
  333. );
  334. run;
  335. /*Total Number of Rows = 3818*/
  336.  
  337.  
  338. /*Get count of low income households based on listed conditions*/
  339. proc sql;
  340. select count(*) as N_Obs
  341. from NULI3
  342. where
  343. persons <= rooms
  344. and
  345. (smocapi<= 30 or grapi<=30);
  346. quit;
  347. /*N_Obs =3793*/
  348.  
  349. /*Proportion : 3515/3818 = .9206 */
  350.  
  351.  
  352.  
  353.  
  354. proc sql;
  355. select puma1, count(*) as obs
  356. from oklahoma
  357. group by puma1;
  358. quit;
  359.  
  360. proc sql;
  361. select puma1, count(*) as obs
  362. from colorado
  363. group by puma1;
  364. quit;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement