Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* ALL OKLAHOMA */
- /* CALCULATE PROPORTION OF LOW INCOME FAMILIES */
- /* Get data with households that house a single family */
- DATA singlefamilyhhtokl;
- SET project.g6oklcol;
- IF state=40;
- IF hht=1 or hht=2 or hht=3;
- run;
- /*Total Number of Rows = 45568 */
- proc sql;
- select puma1, count(*) as N_Obs
- from singlefamilyhhtokl
- group by puma1;
- quit;
- /*median of single family household*/
- PROC MEANS data=singlefamilyhhtokl(where=(persons=4)) median noprint;
- class puma1;
- var hinc;
- weight hweight;
- output out = test median= med;
- run;
- proc print data=test;
- run;
- /*Get count of low income households based on listed conditions*/
- proc sql;
- select count(*) as N_Obs
- from singlefamilyhhtokl
- where puma1=40100
- and
- (persons=4 and hinc<.8*(42900)
- or
- persons=3 and hinc< .9*(.8*(42900))
- or
- persons=2 and hinc< .8*(.8*(42900))
- or
- persons=5 and hinc< 1.08*(.8*(42900))
- or
- persons=6 and hinc< 1.16*(.8*(42900))
- );
- quit;
- /*N_Obs=3398*/
- /*Proportion : 3398/9228=0.36822*/
- proc sql;
- select count(*) as N_Obs
- from singlefamilyhhtokl
- where puma1=40201
- and
- (persons=4 and hinc<.8*(49000)
- or
- persons=3 and hinc< .9*(.8*(49000))
- or
- persons=2 and hinc< .8*(.8*(49000))
- or
- persons=5 and hinc< 1.08*(.8*(49000))
- or
- persons=6 and hinc< 1.16*(.8*(49000))
- );
- quit;
- /*N_Obs = 1655*/
- /*Proportion : = 1655/4451=0.371826*/
- proc sql;
- select count(*) as N_Obs
- from singlefamilyhhtokl
- where puma1=40202
- and
- (persons=4 and hinc<.8*(51000)
- or
- persons=3 and hinc< .9*(.8*(51000))
- or
- persons=2 and hinc< .8*(.8*(51000))
- or
- persons=5 and hinc< 1.08*(.8*(51000))
- or
- persons=6 and hinc< 1.16*(.8*(51000))
- );
- quit;
- /*N_Obs=3135*/
- /*Proportion : = 3135/8127=0.3857512*/
- proc sql;
- select count(*) as N_Obs
- from singlefamilyhhtokl
- where
- puma1=40300
- and
- (persons=4 and hinc<.8*(41000)
- or
- persons=3 and hinc< .9*(.8*(41000))
- or
- persons=2 and hinc< .8*(.8*(41000))
- or
- persons=5 and hinc< 1.08*(.8*(41000))
- or
- persons=6 and hinc< 1.16*(.8*(41000))
- );
- quit;
- /*N_Obs=2819*/
- /*Proportion : = 2819/7405=0.380688*/
- proc sql;
- select count(*) as N_Obs
- from singlefamilyhhtokl
- where puma1=40400
- and
- (persons=4 and hinc<.8*(56420)
- or
- persons=3 and hinc< .9*(.8*(56420))
- or
- persons=2 and hinc< .8*(.8*(56420))
- or
- persons=5 and hinc< 1.08*(.8*(56420))
- or
- persons=6 and hinc< 1.16*(.8*(56420))
- );
- quit;
- /*N_Obs=2529*/
- /*Proportion : = 2529/6566=0.385166*/
- proc sql;
- select count(*) as N_Obs
- from singlefamilyhhtokl
- where puma1=40500
- and
- (persons=4 and hinc<.8*(37000)
- or
- persons=3 and hinc< .9*(.8*(37000))
- or
- persons=2 and hinc< .8*(.8*(37000))
- or
- persons=5 and hinc< 1.08*(.8*(37000))
- or
- persons=6 and hinc< 1.16*(.8*(37000))
- );
- quit;
- /*N_Obs=3573*/
- /*Proportion : = 3573/9791=0.364926*/
- /* gives data for new units -- change set */
- DATA newunits;
- SET project.g6oklcol;
- IF yrbuilt=1
- or
- yrbuilt=2
- or
- yrbuilt=3;
- WHERE state=40;
- run;
- proc sql;
- select puma1, count(*) as N_Obs
- from newunits
- group by puma1;
- quit;
- /* LOW INCOME HOUSEHOLDS BASED ON CONDITIONS*/
- proc sql;
- select count(*) as N_Obs
- from newunits
- where
- puma1=40100
- and
- (hht=1 or hht=2 or hht=3)
- and
- (persons=4 and hinc<.8*(42900)
- or
- persons=3 and hinc< .9*(.8*(42900))
- or
- persons=2 and hinc< .8*(.8*(42900))
- or
- persons=5 and hinc< 1.08*(.8*(42900))
- or
- persons=6 and hinc< 1.16*(.8*(42900))
- )
- and
- persons <= rooms
- and
- ((smocapi<= 30 & smocapi>0) or (grapi<=30 & grapi>0));
- quit;
- proc sql;
- select count(*) as N_Obs
- from newunits
- where
- puma1=40201
- and
- (hht=1 or hht=2 or hht=3)
- and
- (persons=4 and hinc<.8*(49000)
- or
- persons=3 and hinc< .9*(.8*(49000))
- or
- persons=2 and hinc< .8*(.8*(49000))
- or
- persons=5 and hinc< 1.08*(.8*(49000))
- or
- persons=6 and hinc< 1.16*(.8*(49000))
- )
- and
- persons <= rooms
- and
- ((smocapi<= 30 & smocapi>0) or (grapi<=30 & grapi>0));
- quit;
- proc sql;
- select count(*) as N_Obs
- from newunits
- where
- puma1=40202
- and
- (hht=1 or hht=2 or hht=3)
- and
- (persons=4 and hinc<.8*(51000)
- or
- persons=3 and hinc< .9*(.8*(51000))
- or
- persons=2 and hinc< .8*(.8*(51000))
- or
- persons=5 and hinc< 1.08*(.8*(51000))
- or
- persons=6 and hinc< 1.16*(.8*(51000))
- )
- and
- persons <= rooms
- and
- ((smocapi<= 30 & smocapi>0) or (grapi<=30 & grapi>0));
- quit;
- proc sql;
- select count(*) as N_Obs
- from newunits
- where
- puma1=40300
- and
- (hht=1 or hht=2 or hht=3)
- and
- (persons=4 and hinc<.8*(41000)
- or
- persons=3 and hinc< .9*(.8*(41000))
- or
- persons=2 and hinc< .8*(.8*(41000))
- or
- persons=5 and hinc< 1.08*(.8*(41000))
- or
- persons=6 and hinc< 1.16*(.8*(41000))
- )
- and
- persons <= rooms
- and
- ((smocapi<= 30 & smocapi>0) or (grapi<=30 & grapi>0));
- quit;
- proc sql;
- select count(*) as N_Obs
- from newunits
- where
- puma1=40400
- and
- (hht=1 or hht=2 or hht=3)
- and
- (persons=4 and hinc<.8*(56420)
- or
- persons=3 and hinc< .9*(.8*(56420))
- or
- persons=2 and hinc< .8*(.8*(56420))
- or
- persons=5 and hinc< 1.08*(.8*(56420))
- or
- persons=6 and hinc< 1.16*(.8*(56420))
- )
- and
- persons <= rooms
- and
- ((smocapi<= 30 & smocapi>0) or (grapi<=30 & grapi>0));
- quit;
- proc sql;
- select count(*) as N_Obs
- from newunits
- where
- puma1=40500
- and
- (hht=1 or hht=2 or hht=3)
- and
- (persons=4 and hinc<.8*(37000)
- or
- persons=3 and hinc< .9*(.8*(37000))
- or
- persons=2 and hinc< .8*(.8*(37000))
- or
- persons=5 and hinc< 1.08*(.8*(37000))
- or
- persons=6 and hinc< 1.16*(.8*(37000))
- )
- and
- persons <= rooms
- and
- ((smocapi<= 30 & smocapi>0) or (grapi<=30 & grapi>0));
- quit;
- DATA NULI;
- SET project.g6oklcol;
- where state=40
- and
- ((yrbuilt=1
- or
- yrbuilt=2
- or
- yrbuilt=3))
- and
- ((hht=1 or hht=2 or hht=3)
- and
- persons=4 and hinc<.8*(42900)
- or
- persons=3 and hinc< .9*(.8*(42900))
- or
- persons=2 and hinc< .8*(.8*(42900))
- or
- persons=5 and hinc< 1.08*(.8*(42900))
- or
- persons=6 and hinc< 1.16*(.8*(42900))
- );
- run;
- proc sql;
- select puma1, count(*) as N_Obs
- from NULI
- group by puma1;
- quit;
- /*Get count of low income households based on listed conditions*/
- proc sql;
- select count(*) as N_Obs
- from NULI
- where
- puma1=40100
- and
- persons <= rooms
- and
- ((smocapi<= 30 & smocapi >0) or (grapi<=30 & grapi>0));
- quit;
- DATA NULI1;
- SET project.g6oklcol;
- where state=40
- and
- ((yrbuilt=1
- or
- yrbuilt=2
- or
- yrbuilt=3))
- and
- ((hht=1 or hht=2 or hht=3)
- and
- persons=4 and hinc<.8*(49000)
- or
- persons=3 and hinc< .9*(.8*(49000))
- or
- persons=2 and hinc< .8*(.8*(49000))
- or
- persons=5 and hinc< 1.08*(.8*(49000))
- or
- persons=6 and hinc< 1.16*(.8*(49000))
- );
- run;
- proc sql;
- select puma1, count(*) as N_Obs
- from NULI1
- group by puma1;
- quit;
- /*Get count of low income households based on listed conditions*/
- proc sql;
- select count(*) as N_Obs
- from NULI1
- where
- puma1=40201
- and
- persons <= rooms
- and
- ((smocapi<= 30 & smocapi >0) or (grapi<=30 & grapi>0));
- quit;
- DATA NULI2;
- SET project.g6oklcol;
- where state=40
- and
- ((yrbuilt=1
- or
- yrbuilt=2
- or
- yrbuilt=3))
- and
- ((hht=1 or hht=2 or hht=3)
- and
- persons=4 and hinc<.8*(51000)
- or
- persons=3 and hinc< .9*(.8*(51000))
- or
- persons=2 and hinc< .8*(.8*(51000))
- or
- persons=5 and hinc< 1.08*(.8*(51000))
- or
- persons=6 and hinc< 1.16*(.8*(51000))
- );
- run;
- proc sql;
- select puma1, count(*) as N_Obs
- from NULI2
- group by puma1;
- quit;
- /*Get count of low income households based on listed conditions*/
- proc sql;
- select count(*) as N_Obs
- from NULI2
- where
- puma1=40202
- and
- persons <= rooms
- and
- ((smocapi<= 30 & smocapi >0) or (grapi<=30 & grapi>0));
- quit;
- DATA NULI4;
- SET project.g6oklcol;
- where state=40
- and
- ((yrbuilt=1
- or
- yrbuilt=2
- or
- yrbuilt=3))
- and
- ((hht=1 or hht=2 or hht=3)
- and
- persons=4 and hinc<.8*(56420)
- or
- persons=3 and hinc< .9*(.8*(56420))
- or
- persons=2 and hinc< .8*(.8*(56420))
- or
- persons=5 and hinc< 1.08*(.8*(56420))
- or
- persons=6 and hinc< 1.16*(.8*(56420))
- );
- run;
- proc sql;
- select puma1, count(*) as N_Obs
- from NULI4
- group by puma1;
- quit;
- /*Get count of low income households based on listed conditions*/
- proc sql;
- select count(*) as N_Obs
- from NULI4
- where
- puma1=40400
- and
- persons <= rooms
- and
- ((smocapi<= 30 & smocapi >0) or (grapi<=30 & grapi>0));
- quit;
- DATA NULI3;
- SET project.g6oklcol;
- where state=40
- and
- ((yrbuilt=1
- or
- yrbuilt=2
- or
- yrbuilt=3))
- and
- ((hht=1 or hht=2 or hht=3)
- and
- persons=4 and hinc<.8*(41000)
- or
- persons=3 and hinc< .9*(.8*(41000))
- or
- persons=2 and hinc< .8*(.8*(41000))
- or
- persons=5 and hinc< 1.08*(.8*(41000))
- or
- persons=6 and hinc< 1.16*(.8*(41000))
- );
- run;
- proc sql;
- select puma1, count(*) as N_Obs
- from NULI3
- group by puma1;
- quit;
- /*Get count of low income households based on listed conditions*/
- proc sql;
- select count(*) as N_Obs
- from NULI3
- where
- puma1=40300
- and
- persons <= rooms
- and
- ((smocapi<= 30 & smocapi >0) or (grapi<=30 & grapi>0));
- quit;
- DATA NULI5;
- SET project.g6oklcol;
- where state=40
- and
- ((yrbuilt=1
- or
- yrbuilt=2
- or
- yrbuilt=3))
- and
- ((hht=1 or hht=2 or hht=3)
- and
- persons=4 and hinc<.8*(37000)
- or
- persons=3 and hinc< .9*(.8*(37000))
- or
- persons=2 and hinc< .8*(.8*(37000))
- or
- persons=5 and hinc< 1.08*(.8*(37000))
- or
- persons=6 and hinc< 1.16*(.8*(37000))
- );
- run;
- proc sql;
- select puma1, count(*) as N_Obs
- from NULI5
- group by puma1;
- quit;
- /*Get count of low income households based on listed conditions*/
- proc sql;
- select count(*) as N_Obs
- from NULI5
- where
- puma1=40500
- and
- persons <= rooms
- and
- ((smocapi<= 30 & smocapi >0) or (grapi<=30 & grapi>0));
- quit;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement