Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* NEW JERSEY */
- /* CALCULATE PROPORTION OF LOW INCOME FAMILIES */
- /* Get data with households that house a single family --change set */
- DATA singlefamilyhht;
- SET project.gnj;
- IF hht=1 or hht=2 or hht=3;
- run;
- /* THIS IS TO GET THE COUNTS FOR PUMA1 -- NOTHING TO CHANGE, JUST GET THE "TOTAL" FOR YOUR PUMA1*/
- proc sql;
- select puma1, count(*) as N_Obs
- from singlefamilyhht
- group by puma1;
- quit;
- /* 34011 TOTAL : 9558 */
- /*median of single family household*/
- PROC MEANS data=singlefamilyhht(where=(persons=4)) median noprint;
- class puma1;
- var hinc;
- weight hweight;
- output out = test median= med;
- run;
- proc print data=test;
- run;
- /* ALL OF THE MEDIANS
- 11 61000.00
- 12 68000.00
- 20 68400.00
- 30 88000.00
- 41 77400.00
- 42 84040.00
- 50 103000.00
- 60 65400.00
- 70 47800.00
- 80 75000.00
- 90 92000.00
- 101 80000.00
- 102 99000.00
- 110 64400.00
- 120 79300.00
- */
- /*Get count of low income households based on listed conditions -- CHANGE THE PUMA1 AND THE MEDIAN*/
- proc sql;
- select count(*) as N_Obs
- from singlefamilyhht
- where puma1=34011
- and
- (persons=4 and hinc<.8*(61000)
- or
- persons=3 and hinc< .9*(.8*(61000))
- or
- persons=2 and hinc< .8*(.8*(61000))
- or
- persons=5 and hinc< 1.08*(.8*(61000))
- or
- persons=6 and hinc< 1.16*(.8*(61000)))
- ;
- quit;
- /* 34011: N_Obs =3536*/
- /* 34011 Proportion : 3536/9558 = .36995 */
- /* CALCULATE PROPORTION OF LOW INCOME, AFFORDABLE, AND NOT CROWDED AMONG NEW UNITS */
- /* gives data for new units -- change set */
- DATA newunits;
- SET project.gnj;
- IF yrbuilt=1
- or
- yrbuilt=2
- or
- yrbuilt=3;
- run;
- /*GIVES TOTAL COUNT FOR PUMA1S -- DONT CHANGE JUST LOOK AT your PUMA1 */
- proc sql;
- select puma1, count(*) as N_Obs
- from newunits
- group by puma1;
- quit;
- /* TOTAL FOR 34011: 1693 */
- /*Get count of low income households based on listed conditions*/
- proc sql;
- select count(*) as N_Obs
- from newunits
- where
- puma1=34011
- and
- (hht=1 or hht=2 or hht=3)
- and
- (persons=4 and hinc<.8*(61000)
- or
- persons=3 and hinc< .9*(.8*(61000))
- or
- persons=2 and hinc< .8*(.8*(61000))
- or
- persons=5 and hinc< 1.08*(.8*(61000))
- or
- persons=6 and hinc< 1.16*(.8*(61000))
- )
- and
- persons <= rooms
- and
- ((smocapi<= 30 & smocapi>0) or (grapi<=30 & grapi>0));
- quit;
- /* COUNT IS 105 */
- /*Proportion : 105/1693 = .06202 */
- /* CALCULATE PROPORTION OF AFFORDABLE AND NOT CROWDED AMONG NEW UNITS OCCUPIED BY LOW INCOME FAMILIES */
- /* change set */
- DATA NULI;
- SET project.gnj;
- where (yrbuilt=1
- or
- yrbuilt=2
- or
- yrbuilt=3)
- and
- ((hht=1 or hht=2 or hht=3)
- and
- persons=4 and hinc<.8*(61000)
- or
- persons=3 and hinc< .9*(.8*(61000))
- or
- persons=2 and hinc< .8*(.8*(61000))
- or
- persons=5 and hinc< 1.08*(.8*(61000))
- or
- persons=6 and hinc< 1.16*(.8*(61000))
- );
- run;
- /*GIVES TOTAL COUNT FOR PUMA1S -- DONT CHANGE JUST LOOK AT your PUMA1 */
- proc sql;
- select puma1, count(*) as N_Obs
- from NULI
- group by puma1;
- quit;
- /* TOTAL FOR 34011 : 361*/
- /*Get count of low income households based on listed conditions -- change puma1*/
- proc sql;
- select count(*) as N_Obs
- from NULI
- where
- puma1=34011
- and
- persons <= rooms
- and
- ((smocapi<= 30 & smocapi >0) or (grapi<=30 & grapi>0));
- quit;
- /*N_Obs =111*/
- /*Proportion : 111/361 = .307479*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement