SAS results exemplar 4

 This is an HTML version of the SAS program ex4.sas
 To run the program you must read ex4.sas into SAS
 to view the ouptut from these commands in html go to sas results page

Links in this page

Equal opportunities policies weighted and unweighted - Table 4.3 E O policy by workplace size Table 4.4 Other factors by equal opportunities policy Table 4.5 Finite population corrections Table 4.8
/*---------------------------------------------------------------- ex4.sas Code to run exemplar 4 Written by Gillian Raab November 2004 first tell sas where the data for this exemplar is stored Change this to the directory where YOU have the data -----------------------------------------------------------------*/ libname exemp4 "c:/documents and settings/gillian raab/my documents/aprojects/peas/ex4datafiles/data"; /*------------------------------------------------- Now you should open the file ex4_formats.sas and run it to set up the formats you will need for these analyses Check log file to see that it has worked ----------------------------------------------------*/ Back to topuparrow /*-------------------------------------------------------------- first weighted and unweighted means of proportion with eo policy Table 4.3 --------------------------------------------------------------*/ PROC surveymeans data=exemp4.ex4 mean stderr nobs clm; var eo; strata strata; weight est_wt; run; PROC surveymeans data=exemp4.ex4 mean stderr nobs clm; weight est_wt; var eo; strata strata; run; /*------------------- without startification----------------------*/ PROC surveymeans data=exemp4.ex4 mean stderr nobs clm; var eo; weight est_wt; run; Back to topuparrow /*-----now eo by workplace size-----table4.4--------------*/ PROC surveymeans data=exemp4.ex4 mean stderr nobs clm; weight est_wt; var eo; strata strata; domain nempsize; run; Back to topuparrow /*---------------------------------------------------------------------- now compare means and proportions by eo and non eo workplaces table 4.5 --------------------------------------------------------------------*/ PROC surveymeans data=exemp4.ex4 mean stderr nobs clm; weight est_wt; var female ethnic disabgrp; class disabgrp; format disabgrp disabgrp.; strata strata; domain eo; run; /*------------------- and the same thing unweighted-----------------*/ PROC surveymeans data=exemp4.ex4 mean stderr nobs clm; var female ethnic disabgrp; class disabgrp; format disabgrp disabgrp.; strata strata; domain eo; run; /*--------------------------------------------------------- to get a t-test you need to use the regresion PROCedure ---------------------------------------------------*/ PROC surveyreg data=exemp4.ex4; weight est_wt; strata strata; model female=eo ; ods select ParameterEstimates; run; PROC surveyreg data=exemp4.ex4; weight est_wt; strata strata; model ethnic=eo ; ods select ParameterEstimates; run; /*------------------------------------------------------ and they can be compared with an ordinary t-test ------------------------------------------------------*/ PROC ttest data=exemp4.ex4; var female ethnic; class eo; run; /*------------------------------------------------------- SAS version 8 does not do logistic regression, but with a sample this size oridinary regression will be OK though obviously not exactly the same as the logistic regressions Version 9 will -----------------------------------------------------------------------*/ Back to topuparrow /*------------------------------------------------------------ now testing the effect of a finite population correction For this we need to make a SAS table with a record for each startum and a variable _rate_ with the sampling fraction table 4.8 -----------------------------------------====---------------*/ PROC sort data=exemp4.ex4 out=rates; by strata; run; data rates; set rates; by strata; if first.strata; _rate_=sampfrac; keep _rate_ strata; run; PROC surveymeans data=exemp4.ex4 mean stderr nobs clm rate=rates; weight est_wt; var eo; strata strata; domain nempsize; run;