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

Hi All

The following table is a sample of my data set where the patients are the control before diagnosis and are the case after diagnosis.

 

New_id

A1C pre

A1C Cat pre

A1C post

A1C Cat post

A

7

0

6

0

B

-

-

8

0

C

9

1

-

-

D

10

2

17

3

E

-

-

-

-

F

8

0

7

0

 

I would like to compare between the readings of A1C pre and post for each patient, to know if the exposure had an effect on the A1C level and if there is a significance difference.

 

Thanks for your help

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

@ALAA1 wrote:

Hi All

The following table is a sample of my data set where the patients are the control before diagnosis and are the case after diagnosis.

 

New_id

A1C pre

A1C Cat pre

A1C post

A1C Cat post

A

7

0

6

0

B

-

-

8

0

C

9

1

-

-

D

10

2

17

3

E

-

-

-

-

F

8

0

7

0

 

I would like to compare between the readings of A1C pre and post for each patient, to know if the exposure had an effect on the A1C level and if there is a significance difference.

 

Thanks for your help


Typically to make any statistically reliable statement about what I have highlighted in blue above you have to include all of the patients. One of the typical tests would be to test if the mean difference across all patients, or subgroups of patients such as gender, age or some such, is larger or smaller. One the tests used for such is a Paired t-test which tests if the mean difference between the before and after is 0 or not.

 

Another test might be a sign test, compare the before/after just in a larger/smaller way (magnitude makes no difference). This basically tests whether there is any difference in before/after.

 

But you use all of the patients. Why do you think they bothered to collect data from more than one patient?

View solution in original post

6 REPLIES 6
PaigeMiller
Diamond | Level 26
You don't actually say this, in fact you say something different, so I feel a need to ask. Do you want to compare the average of the pre to the average of the post?
--
Paige Miller
ALAA1
Obsidian | Level 7
thank you for your reply.

Not really!
I will explain more
each patient is a control before exposure (diagnosis) and after exposure (diagnosis) is become a case ( within patient comparison).
So, each patient has one reading as a control which is A1C pre (actual reading) and A1C cat pre (category) and one reading as a case which is A1C post (actual reading) and A1C cat post (category).

I hope you that I explained it well.
PaigeMiller
Diamond | Level 26
So you don't want to compare averages. I don't know what analysis you do want. Can you show what you want as an analysis for your small example?
--
Paige Miller
PGStats
Opal | Level 21

To perform paired post-pre tests, create new variables for the change in values and test for location with proc univariate:

 

data have;
input New_id $ A1Cpre A1CcatPre A1Cpost A1CcatPost;
datalines;
A   7   0   6   0
B   .   .   8   0
C   9   1   .   .
D   10  2   17  3
E   .   .   .   .
F   8   0   7   0
;

data change;
set have;
A1Cchange = A1Cpost - A1cpre;
A1CcatChange = A1CcatPost - A1CcatPre;
run;

proc univariate data=change;
var A1Cchange A1CcatChange;
run;

Look at the Tests for Location table.

Note: this is assuming that both your variables are ordinal.

PG
ballardw
Super User

@ALAA1 wrote:

Hi All

The following table is a sample of my data set where the patients are the control before diagnosis and are the case after diagnosis.

 

New_id

A1C pre

A1C Cat pre

A1C post

A1C Cat post

A

7

0

6

0

B

-

-

8

0

C

9

1

-

-

D

10

2

17

3

E

-

-

-

-

F

8

0

7

0

 

I would like to compare between the readings of A1C pre and post for each patient, to know if the exposure had an effect on the A1C level and if there is a significance difference.

 

Thanks for your help


Typically to make any statistically reliable statement about what I have highlighted in blue above you have to include all of the patients. One of the typical tests would be to test if the mean difference across all patients, or subgroups of patients such as gender, age or some such, is larger or smaller. One the tests used for such is a Paired t-test which tests if the mean difference between the before and after is 0 or not.

 

Another test might be a sign test, compare the before/after just in a larger/smaller way (magnitude makes no difference). This basically tests whether there is any difference in before/after.

 

But you use all of the patients. Why do you think they bothered to collect data from more than one patient?

ALAA1
Obsidian | Level 7
thank you for your reply
please can provide me with the codes of paired t test?
and should I multiple impute the missing data?

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 6 replies
  • 1385 views
  • 0 likes
  • 4 in conversation