Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* ALL NEW JERSEY */
- /* Get the summary statistics */
- PROC MEANS DATA=PROJECT.gnj mean median n stddev min max;
- var finc hinc ;
- run;
- /* CALCULATE PROPORTION OF LOW INCOME FAMILIES */
- /* Get data with households that house a single family */
- DATA singlefamilyhht;
- SET project.gnj;
- IF hht=1 or hht=2 or hht=3;
- run;
- /*Total Number of Rows = 107529 */
- /*median of single family household*/
- PROC MEANS data=singlefamilyhht(where=(persons=4)) median;
- var hinc;
- weight hweight;
- run;
- /*Note median =76000.00*/
- /*
- data step;
- set singlefamilyhht;
- low_income=0;
- if persons=4 and hinc<.8*(76000) then low_income = 1;
- if persons=3 and hinc< .9*(.8*(76000)) then low_income = 1;
- if persons=2 and hinc< .8*(.8*(76000))then low_income = 1;
- if persons=5 and hinc< 1.08*(.8*(76000)) then low_income = 1;
- if persons=6 and hinc< 1.16*(.8*(76000)) then low_income = 1;
- count = 1;
- run;
- Proc sql;
- Create table Step2 as
- Select SUM(low_income) AS low_income, sum(count) as total
- From step
- ;
- */
- /*Get count of low income households based on listed conditions*/
- proc sql;
- select count(*) as N_Obs
- from singlefamilyhht
- where persons=4 and hinc<.8*(76000)
- or
- persons=3 and hinc< .9*(.8*(76000))
- or
- persons=2 and hinc< .8*(.8*(76000))
- or
- persons=5 and hinc< 1.08*(.8*(76000))
- or
- persons=6 and hinc< 1.16*(.8*(76000));
- quit;
- /*N_Obs =41468*/
- /*Proportion : 41468/107529 = .38564 */
- /* CALCULATE PROPORTION OF LOW INCOME, AFFORDABLE, AND NOT CROWDED AMONG NEW UNITS */
- DATA newunits;
- SET project.gnj;
- IF yrbuilt=1
- or
- yrbuilt=2
- or
- yrbuilt=3;
- run;
- /*Total Number of Rows = 15275*/
- /*Get count of low income households based on listed conditions*/
- proc sql;
- select count(*) as N_Obs
- from newunits
- where
- ((hht=1 or hht=2 or hht=3)
- and persons=4 and hinc<.8*(76000)
- or
- persons=3 and hinc< .9*(.8*(76000))
- or
- persons=2 and hinc< .8*(.8*(76000))
- or
- persons=5 and hinc< 1.08*(.8*(76000))
- or
- persons=6 and hinc< 1.16*(.8*(76000))
- )
- and
- persons <= rooms
- and
- (smocapi<= 30 or grapi<=30);
- quit;
- /*N_Obs =3124*/
- /*Proportion : 3124/15275 = .20452 */
- /* CALCULATE PROPORTION OF AFFORDABLE AND NOT CROWDED AMONG NEW UNITS OCCUPIED BY LOW INCOME FAMILIES */
- 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*(76000)
- or
- persons=3 and hinc< .9*(.8*(76000))
- or
- persons=2 and hinc< .8*(.8*(76000))
- or
- persons=5 and hinc< 1.08*(.8*(76000))
- or
- persons=6 and hinc< 1.16*(.8*(76000))
- );
- run;
- /*Total Number of Rows = 3386*/
- /*Get count of low income households based on listed conditions*/
- proc sql;
- select count(*) as N_Obs
- from NULI
- where
- persons <= rooms
- and
- (smocapi<= 30 or grapi<=30);
- quit;
- /*N_Obs =3124*/
- /*Proportion : 3124/3386 = .92262*/
- /* ALL OKLAHOMA */
- DATA oklahoma;
- SET project.g6oklcol;
- IF state=40;
- run;
- /*Total Number of Rows = 63590 */
- /* CALCULATE PROPORTION OF LOW INCOME FAMILIES */
- /* Get data with households that house a single family */
- DATA singlefamilyhht2;
- SET oklahoma;
- IF hht=1 or hht=2 or hht=3;
- run;
- /*Total Number of Rows = 45568 */
- /*median of single family household*/
- PROC MEANS data=singlefamilyhht2(where= (persons=4)) median;
- var hinc;
- weight hweight;
- run;
- /*Note median =47000*/
- /*Get count of low income households based on listed conditions*/
- proc sql;
- select count(*) as N_Obs
- from singlefamilyhht2
- where persons=4 and hinc<.8*(47000)
- or
- persons=3 and hinc< .9*(.8*(47000))
- or
- persons=2 and hinc< .8*(.8*(47000))
- or
- persons=5 and hinc< 1.08*(.8*(47000))
- or
- persons=6 and hinc< 1.16*(.8*(47000));
- quit;
- /*N_Obs =13812*/
- /*Proportion : 18274/45568 = .4010 */
- /* CALCULATE PROPORTION OF LOW INCOME, AFFORDABLE, AND NOT CROWDED AMONG NEW UNITS */
- DATA newunits2;
- SET oklahoma;
- IF yrbuilt=1
- or
- yrbuilt=2
- or
- yrbuilt=3;
- run;
- /*Total Number of Rows = 8827*/
- /*Get count of low income households based on listed conditions*/
- proc sql;
- select count(*) as N_Obs
- from newunits2
- where
- ((hht=1 or hht=2 or hht=3)
- and
- persons=4 and hinc<.8*(47000)
- or
- persons=3 and hinc< .9*(.8*(47000))
- or
- persons=2 and hinc< .8*(.8*(47000))
- or
- persons=5 and hinc< 1.08*(.8*(47000))
- or
- persons=6 and hinc< 1.16*(.8*(47000))
- )
- and
- persons <= rooms
- and
- (smocapi<= 30 or grapi<=30);
- quit;
- /*N_Obs =2240*/
- /*Proportion : 2240/8827 = .25377 */
- /* CALCULATE PROPORTION OF AFFORDABLE AND NOT CROWDED AMONG NEW UNITS OCCUPIED BY LOW INCOME FAMILIES */
- DATA NULI2;
- SET oklahoma;
- where (yrbuilt=1
- or
- yrbuilt=2
- or
- yrbuilt=3)
- and
- ((hht=1 or hht=2 or hht=3)
- and persons=4 and hinc<.8*(47000)
- or
- persons=3 and hinc< .9*(.8*(47000))
- or
- persons=2 and hinc< .8*(.8*(47000))
- or
- persons=5 and hinc< 1.08*(.8*(47000))
- or
- persons=6 and hinc< 1.16*(.8*(47000))
- );
- run;
- /*Total Number of Rows = 2386*/
- /*Get count of low income households based on listed conditions*/
- proc sql;
- select count(*) as N_Obs
- from NULI2
- where
- persons <= rooms
- and
- (smocapi<= 30 or grapi<=30);
- quit;
- /*N_Obs =2240*/
- /*Proportion : 2240/2386 = .9388 */
- /* ALL COLORADO */
- DATA colorado;
- SET project.g6oklcol;
- IF state=8;
- run;
- /*Total Number of Rows = 80732 */
- /* CALCULATE PROPORTION OF LOW INCOME FAMILIES */
- /* Get data with households that house a single family */
- DATA singlefamilyhht3;
- SET colorado;
- IF hht=1 or hht=2 or hht=3;
- run;
- /*Total Number of Rows = 54168 */
- /*median of single family household*/
- PROC MEANS data=singlefamilyhht3(where= (persons=4)) median;
- var hinc;
- weight hweight;
- run;
- /*Note median =63500.00*/
- /*Get count of low income households based on listed conditions*/
- proc sql;
- select count(*) as N_Obs
- from singlefamilyhht3
- where
- (hht=1 or hht=2 or hht=3)
- and
- persons=4 and hinc<.8*(63500)
- or
- persons=3 and hinc< .9*(.8*(63500))
- or
- persons=2 and hinc< .8*(.8*(63500))
- or
- persons=5 and hinc< 1.08*(.8*(63500))
- or
- persons=6 and hinc< 1.16*(.8*(63500));
- quit;
- /*N_Obs =20617*/
- /*Proportion : 15516/54168 = .28644 */
- /* CALCULATE PROPORTION OF LOW INCOME, AFFORDABLE, AND NOT CROWDED AMONG NEW UNITS */
- DATA newunits3;
- SET colorado;
- IF yrbuilt=1
- or
- yrbuilt=2
- or
- yrbuilt=3;
- run;
- /*Total Number of Rows = 17020*/
- /*Get count of low income households based on listed conditions*/
- proc sql;
- select count(*) as N_Obs
- from newunits3
- where
- ((hht=1 or hht=2 or hht=3)
- and persons=4 and hinc<.8*(63500)
- or
- persons=3 and hinc< .9*(.8*(63500))
- or
- persons=2 and hinc< .8*(.8*(63500))
- or
- persons=5 and hinc< 1.08*(.8*(63500))
- or
- persons=6 and hinc< 1.16*(.8*(63500))
- )
- and
- persons <= rooms
- and
- (smocapi<= 30 or grapi<=30);
- quit;
- /*N_Obs =3515*/
- /*Proportion : 3515/17020 = .20652 */
- /* CALCULATE PROPORTION OF AFFORDABLE AND NOT CROWDED AMONG NEW UNITS OCCUPIED BY LOW INCOME FAMILIES */
- DATA NULI3;
- SET colorado;
- where (yrbuilt=1
- or
- yrbuilt=2
- or
- yrbuilt=3)
- and
- ((hht=1 or hht=2 or hht=3)
- and persons=4 and hinc<.8*(63500)
- or
- persons=3 and hinc< .9*(.8*(63500))
- or
- persons=2 and hinc< .8*(.8*(63500))
- or
- persons=5 and hinc< 1.08*(.8*(63500))
- or
- persons=6 and hinc< 1.16*(.8*(63500))
- );
- run;
- /*Total Number of Rows = 3818*/
- /*Get count of low income households based on listed conditions*/
- proc sql;
- select count(*) as N_Obs
- from NULI3
- where
- persons <= rooms
- and
- (smocapi<= 30 or grapi<=30);
- quit;
- /*N_Obs =3793*/
- /*Proportion : 3515/3818 = .9206 */
- proc sql;
- select puma1, count(*) as obs
- from oklahoma
- group by puma1;
- quit;
- proc sql;
- select puma1, count(*) as obs
- from colorado
- group by puma1;
- quit;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement