BookmarkSubscribeRSS Feed
Anita_n
Pyrite | Level 9

Dear all,

Am trying to compare  C-reactive protein (CRPvalues of patients at visit1 and vist 2

I have table that looks like this :

Variable VISIT N Mean STD
CRP 1 300 3,64 1,19
CRP 2 148 1,95 0,93

 

I wish to compare the N value 148 at visit 2 with exactly 148 values at visit1. I think I can do this by selecting the pat_id with the 148values at visit2 and comparing that with exactly the same patients(with the same pat_id) in visit1 

 

My question is how can I adjust my code to do that? 

here is my code:

 

proc ttest data= myinfile plots=none;
class visit;
var CRP;
where visit in (1,2);
ods output ttests=ttest_CRP;
ods output Statistics=Stat_CRP;
run;
4 REPLIES 4
Ksharp
Super User

Check this example:

 

Ksharp_0-1638188595219.png

Ksharp_1-1638188615366.png

Ksharp_2-1638188644186.png

 

 

PaigeMiller
Diamond | Level 26

Before we show any code, could you clarify something here:

 

I wish to compare the N value 148 at visit 2 with exactly 148 values at visit1. I think I can do this by selecting the pat_id with the 148values at visit2 and comparing that with exactly the same patients(with the same pat_id) in visit1

 

If there are two measurements for each of the 148 patients, then you would want to do a paired t-test for these 148 patients. Is that what you have in mind?

--
Paige Miller
Anita_n
Pyrite | Level 9

@Ksharp @Reeza : Thanks for that.

@PaigeMiller Yes, that is approximately what I want. I think I will try that myself. Thanks

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1134 views
  • 4 likes
  • 4 in conversation