Hello,
i am working with the p-gain method and wondering if someone has experience with the the method.
My data is build up like this and has the Variable name and p-values from single-variable correlations (A1 to An; B1 to Bn) and ratio-correlations (A1_B1 to An_Bn):
Variable var1 var2 p_value p_gain
A1_B1 A1 B1 0.02
A1_B2 A1 B2 0.3
...
A1 A1 . 0.06
A2 A2 . 1
B1 . B1 0.0007
...
Where "variable" is a ratio between the two variables "var1" and "var2". For the p-gain method and therefore the new variable p_gain, I want to calculate the following:
- If the p-value from the first part of the ratio, so here var1 (f.e. A1= 0.06) is smaller than the p-value from the whole ratio (A1_B1 =0.02) then the p_gain-value should be calculated as p_value(A1) / p-value (A1_B1)
- If the p-value from the second part of the ratio, so here var2 (f.e. B1= 0.0007) is smaller than the p-value from the whole ratio (A1_B1 =0.02) then the p_gain-value should be calculated as p_value(B1) / p-value (A1_B1)
Thanks!
It's about table lookup skill and if statement.
data test;
input Variable$ var1$ var2$ p_value p_gain;
cards;
A1_B1 A1 B1 0.02 .
A1_B2 A1 B2 0.3 .
A1 A1 . 0.06 .
A2 A2 . 1 .
B1 . B1 0.0007 .
;
run;
data want;
set test;
if find(Variable,'_') then do;
do i = 1 to rec;
set test(keep=Variable p_value rename=(Variable=tmpVariable p_value=tmppvalue))nobs=rec point=i;
if var1 = tmpVariable then var1pvalue = tmppvalue;
if var2 = tmpVariable then var2pvalue = tmppvalue;
end;
if . < var1pvalue < p_value then p_gain = var1pvalue/p_value;
if . < var2pvalue < p_value then p_gain = var2pvalue/p_value;
end;
drop tmp:;
run;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.