BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sampath
Calcite | Level 5

Hi,

I have the following mock.

Visit           Treatment   N   n (%)      SE        Diff        SE           95% CI                P-value

week x       drug 5mg   X    XX (XX)    XX.XX     XX.XX     XX.XX      XX.XX,  XX.XX        0. XX.XX

                   

                Placebo      X    XX (XX)    XX.XX     XX.XX     XX.XX      XX.XX,  XX.XX        0. XX.XX

I have calculated the 95% CI  and the  P-values using Cochran-Mantel-Haenszel Test. I have used the following code.

proc freq data = dat1 ;

    output out = dat2 cmh;

     tables visit*TRTGRP*AVAL / cmh t norow nopercent relrisk alpha=0.05;

     run;

1)  I was wondering if we can calculate both both upper and lower CI values using  Cochran-Mantel-Haenszel Test.

2) Could any one suggest me how to calculate SE and Diff?

Thanks,

Sam.

1 ACCEPTED SOLUTION

Accepted Solutions
sampath
Calcite | Level 5

Thank you very much Fayaz. These are really helpful.

View solution in original post

12 REPLIES 12
SteveDenham
Jade | Level 19

The standard error of a proportion is estimated as sqrt(p * (1-p) / N), so that should be relatively easy to compute.  I have some difficulty with what the Diff variable is supposed to represent.  I assume it is a difference, but you need to specify what difference you want to compute.  And then calculating the standard error of the difference in proportions would be sqrt [ p1 * (1-p1)/N1 + p2 * (1-p2)/N2].

Steve Denham

sampath
Calcite | Level 5

Thanks Steve.

1) I am trying calculate the difference between two treatment groups (Active, Placebo).

2) Could you please let me know the Options in proc freq to get these SE, Difference.

SteveDenham
Jade | Level 19

I don't know that there are options to get them in the output.  I think you will need to use ODS to get the values into datasets, merge them appropriately, and calculate Difference, SE, and SE of the Difference in a data step.  Maybe someone else that uses PROC FREQ on a more regular basis than me can give additional input.

An alternative would be to use PROC GLIMMIX, which would generate all of these as standard output, and where I could probably be more useful in my answers.

Steve Denham

Message was edited by: Steve Denham

sampath
Calcite | Level 5

Hi Steve,

I am a new bee to PROC GLIMMIX, but would be very much interested to know about it. I am aware of anova, proc mixed where we compare more than two treatment groups. I was wondering if it is the same with PROC GLIMMIX.

SteveDenham
Jade | Level 19

If you could describe your dataset 'dat1' (you know, what variables are in it and something about their characteristics), I think it might be quite easy to pull together PROC GLIMMIX code that addresses your needs.

Steve Denham

sampath
Calcite | Level 5

Hi Steve,

The data is in the following way.

USUBJID  STUDYID    Visit           TRTGRP       AVAL


10001     ENL0019      week1        drug 5mg        22.4


10002     ENL0019      week1        drug 10mg        56.2


It has the variables USUBJID, STUDYID, Visit, TRTGRP, AVAL.

USUBJID is the subject identifying number.

Studyid  is the study identifying number.

Visit is the actual visit that the patient visited the hospital.

TRTGRP is the treatment given to the patient like drug 5 mg, 10 mg etc.

AVAL has the lab values collected from subject.

SteveDenham
Jade | Level 19

Interesting.  PROC FREQ and CMH analyses depends on a binomial (yes/no) response, so unless you have a hard and fast cutpoint for AVAL, and include it somehow in the dataset, PROC FREQ is not going to give you what you need..  Here it looks as though your response is a continuous variable.  This is certainly a case for GLIMMIX.  One more question about the variable Visit--what are the possible values that it can take on?  Do you have observations for all subjects at all weeks (worried some about drop-out)?  Once we have this I think a mixed model approach of some sort would be much more appropriate.

Possible code:

proc glimmix data=dat1;

class usubjid studyid visit trtgrp;

model aval=trtgrp visit trtgrp*visit;

random studyid;

random visit/residual type=<this will depend on the values that visit takes on> subject=usubjid;

lsmeans trtgrp visit trtgrp*visit;

lsmestimate <as needed to address results.;

run;

Steve Denham

sampath
Calcite | Level 5

Thanks Steve.

The visit variable can take on week 1, week 2, .... up to week 12. There are some drop outs too.

PROC GLIMMIX looks similar to proc mixed. Just wondering what differentiates it from PROC MIXED?

.

SteveDenham
Jade | Level 19

GLIMMIX is similar, being a mixed model procedure.  It provides different distributions for the dependent variable, which may be critical for lab values, as they are often log normal in their distribution.  It also provides an EFFECT statement, which is useful for fitting splines to repeated measures over time, and which often are superior in the face of drop outs.

In your data, I would do something to get visit into a numeric variable, say studyweek, and try the following:

proc glimmix data=dat1;

class usubjid studyid studyweek trtgrp;

model aval=trtgrp studyweek trtgrp*studyweek;

random intercept studyid/subject=usubjid;

random studyweek/residual type=<AR(1), ARH(1) or perhaps ANTE(1)> subject=usubjid;

lsmeans trtgrp studyweek trtgrp*studyweek/diff;

*lsmestimate <as needed to address results.;

run;

The reason for shifting to studyweek over visit is that it will index the visits in numerical order, while visit will index in alphanumeric, so that week11 would come immediately after week1, and this will invalidate the time dependent error structures.

Steve Denham

sampath
Calcite | Level 5

Thank you very much Steve. This is very helpful.

sampath
Calcite | Level 5

Thank you very much Fayaz. These are really helpful.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 12 replies
  • 3815 views
  • 6 likes
  • 3 in conversation