- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I'm having a bit of trouble setting up my SAS equation here and would value some input:
The prompt
- calculate the P values for continuous variables comparing first values at first echo date and last echo date for:
Max wall thickness in Echo 1 vs Max wall thickness in Echo 2
LVEDd in Echo 1 vs LVEDd in Echo 2
EF in Echo 1 vs EF in Echo 2
LA in Echo 1 vs LA in Echo 2
Example data looks something like this:
How do I set up the values for comparison Value 1 Max Wall thickness vs Value 2 Wall thickness AND Value 1 LVEDd vs Value 2 LVEDd AND EF 1 value vs. EF 2 value AND LA 1 value vs. LA 2 value?
My guess was this:
libname Hetal "\\tuftsmc\home\hpatel3\SAS Class Datasets";
run;
proc import out= Hetal. ES_ Pvals datafile= "\\tuftsmc\home\hpatel3\SAS Datasets\surv_unemp.csv" dbms=csv replace;
getnames=yes; datarow=2;
run;
proc freq data=Hetal.es_pvals order=formatted;
Tables MWT1*MWT2 / chisq;
Title "Comparison of Key variables at First Echo vs Last Echo in ES patients";
run;
What I keep getting is this:
What I'm assuming I want is a p value, ie the comparison between MWT1 and MWT2 and their association .0001 (or something).
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I would consider using the TTEST procedure with the PAIRED statement. See this example from the documentation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi there,
I suggest setting up a indicator variable to denote whether the measure comes from the first time or second time.
And then in your proc freq, add a by statement with the new variable. This should separate out your data and compare the variable across time points.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi, @aebabinec. So instead of proc freq, I tried using a one-sample T-Test just now since I'm comparing two points of the same variable. Does that work? Is my code correct? should I be worried that some of my means are negative?(code and results attached)
And my Pvalues (and results )are thus:
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I would consider using the TTEST procedure with the PAIRED statement. See this example from the documentation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Examining the same variable at 2 different points is a paired design.
If continuous variable, then you can do T1-T2 (or T2-T1) to get the differences and then run PROC UNIVARIATE to get the p-value for Signed rank test (Null hypothesis is that the difference is equal to zero).
If the variable is categorical then it would be a 2x2 paired table and can use McNemar's test to get the p-value which compares the marginal frequencies. The odds ratio here would be labelled as conditional odds ratio that will be calculated using the discordant cells (Null hypothesis is OR=1).
Hope this helps.
Ashutosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@sld@tamhane: It seems I don't understand this as well as I thought
The example given by you (SLD) showed this:
and the code I have is this:
My data has 4 variables I am looking at at date of first echo and date of last echo. Your example has two comparison times SBP Before * SBP after. However I have 4 variables being measure at Date of first Echo and Date of Last echo:
:MWT (mm) at time of first echo
MWT (mm) at time of last echo
EF (%) at time of first echo
EF (%) at time of last echo
I'm not sure what the "paired" statement code would be like for this many variables. Can you elucidate a bit? Between what variables would my asterisk go between? MWT*_____ LVEDD*_____ EF*______ LA*_____
or would it look like something different?
etc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
In your code, you are computing the difference (time 1 - time 2), and then using that difference in proc TTEST. As you have suspected, this is not correct.
As noted by @tamhane, you can either (1) compute the difference and then test whether the difference is zero using proc UNIVARIATE using differences as the response variable, or (2) you can use pairs of values in proc TTEST with the PAIRED statement.
Each variable--MWT, LVEDD, EF and LA--will be analyzed separately.
For example, using TTEST with PAIRED using pairs of values
proc ttest data=hetal.es_pv;
paired MWT1*MWT2;
run;