SAS code for comparing individual improvement in education between pre-program and post-program

Reply
New Contributor
Posts: 3

SAS code for comparing individual improvement in education between pre-program and post-program

I am trying to write a code to look at if a subject improved in their education level after finishing prenatal program.  I have their education level when they entered the program and their education level when they exited the program.  I would like to know if they improved in education.

Super User
Posts: 10,035

Re: SAS code for comparing individual improvement in education between pre-program and post-program

check proc ttest .proc par1way ;

New Contributor
Posts: 3

Re: SAS code for comparing individual improvement in education between pre-program and post-program


I thought proc ttest was for means so I didn't think that would work. What is proc par1way?  The categories for education level are:

01: less than 8th grad

03: some high school

02: high school grad/ged

04: some college

05: two year degree

06: four year degree

07: graduate school

09: vocational school

08: unknown

The mother's are asked about their education level at the intial enterance to the program and at the exit of the program.

Super User
Posts: 10,035

Re: SAS code for comparing individual improvement in education between pre-program and post-program

Are you talking about multi-compare .

check proc glm + mean

Respected Advisor
Posts: 4,927

Re: SAS code for comparing individual improvement in education between pre-program and post-program

Well, social studies is not my realm but, given that Post-Program occurs after Pre-Program and that education level can only go up with time (if Unknown is taken out), I would say that education level can only go up between Pre and Post program.

If you enroll enough subjects, you are bound to show an average improvement in education level.

It might be more useful to estimate the fraction of mothers that improved their education level during the prenatal program.

PG

PG
New Contributor
Posts: 3

Re: SAS code for comparing individual improvement in education between pre-program and post-program

PGStats,

That is what I am trying to estimate.  The fraction of mothers who showed improvment from initial to exit. So improvment being anything better than they're initial education level: "some high school" better than "less than 8th grade" or "high school grad/GED" better than  "some high school"  etc and so on.  I am just not sure how to code for that since they are not means, but values assigned to different categories.

Respected Advisor
Posts: 4,927

Re: SAS code for comparing individual improvement in education between pre-program and post-program

For a simple estimate, assuming education levels are number and not character variables, you could use something like:

%let missingEdLevel=8;

proc sql;

select sum(exitEdLevel > entryEdLevel) / count(exitEdLevel) as percentImproved format=percentn7.1

from myData

where entryEdLevel ne &missingEdLevel and exitEdLevel ne &missingEdLevel;

quit;

PG

PG
Super User
Posts: 19,822

Re: SAS code for comparing individual improvement in education between pre-program and post-program

I would consider the following valid:

Remove unknown.

Your categories are generally ordinal not nominal, so 8 is better than 7 with the exception of 9, which is vocational school.  Perhaps change the coding to deal with that. But what happens if someone has a 4 year degree and vocational school...which is considered the higher education? Assuming it's a single selection field.

If you do categorize with an ordinal scale you can do a t-test with paired analysis.

SAS/STAT(R) 9.2 User's Guide, Second Edition

Check your data to ensure that you don't have any negatives due to incorrect coding, since its essentially impossible to unachieved an education level.

Respected Advisor
Posts: 4,927

Re: SAS code for comparing individual improvement in education between pre-program and post-program

I don’t consider appropriate to submit a non-negative variable to a t-test. Individual improvement could however be modelled as a binomial variate and its proportion be estimated with something like:

/* Create a variable that has value 1 when there is individual improvement and zero otherwise */

%let missingEdLevel=8;

proc sql;

create table test as

select *, 

          exitEdLevel > entryEdLevel as improvedEd

from myData

where

          entryEdLevel ne &missingEdLevel and

          exitEdLevel ne &missingEdLevel ;

quit;

/* Estimate individual improvement proportion and compare the estimate with a treshold, 10% for example */

proc freq data=test;

table improvedEd / binomial(exact level="1" p=0.1);

exact binomial;

run;

Proc freq also provides other useful tests for proportions. 

PG

PG
Super User
Posts: 19,822

Re: SAS code for comparing individual improvement in education between pre-program and post-program

That has the same issue as a t-test, the 09 code isn't necessarily higher than a vocational school.  The data would have to be recoded somehow first.

Trusted Advisor
Posts: 1,228

Re: SAS code for comparing individual improvement in education between pre-program and post-program

Simplest way is to run a crosstab between before and and after education levels. If most of the numbers are on the diagonal then there is no improvement. With regard to statistical point of view you can run a chi-square test.

Super User
Posts: 10,035

Re: SAS code for comparing individual improvement in education between pre-program and post-program

I know it is McNemar's test .Check AGREE option of proc freq. But that is only suited for 2*2 contingency table.

I recommend to use corresponding analysis for n*n contingency table.

Ask a Question
Discussion stats
  • 11 replies
  • 376 views
  • 0 likes
  • 5 in conversation