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

Hi all,

 

I am working on relative risk calculations for txgroup * placebo over 3 visits (week 7, 14, and 21).  This problem I am having is for some reason, the direction of the rows is switching at week 14.  

 

So say A is row 1,  I is row 2;  Difference is (Row 1 - Row 2)  and computes normally.

 

This will change to I as row 1 and A as row 2 for week 14.

 Resulting  Difference is (Row 1 - Row 2) is backwards.

 

Is there a trick to holding the row positioning  constant?  the column position is accurate so specifying  column=1 does not change anything.


%macro fish1 (tx1, tx2, num, t);
proc sort data = cfrsdx; by avisitn descending avalc; run;
proc freq data = cfrsdx order=data;
   by avisitn;
   %if &t=0 %then %do;
	 where avisitn in (7 14 21) and tx in (&tx1, &tx2) & ittfl='Y' ;
   %end;
   %else %do;
	 where avisitn=(14)  and tx in (&tx1, &tx2)  & complfl = "Y";
   %end;
   table tx * avalc / chisq riskdiff (cl=newcombe) missing;
   output out=pdata&num fisher riskdiff1;
   ods output PdiffCLs=data#
run;
%mend fish1;

 

1 ACCEPTED SOLUTION

Accepted Solutions
jenim514
Pyrite | Level 9

@ ballardw I just tried adding tx to end of my sort, and I think this did the trick!!  Sorry, i will try to explain better next time.  But thank you!!

View solution in original post

2 REPLIES 2
ballardw
Super User

Without data to see what is actually going on I suspect you are getting an interaction between the WHERE clauses and the order of TX within avisitn and  avalc. I might try adding TX to the sort as well.

 

If you are going to mention the role of a variable in narrative please make sure that you reference which variable. I don't see a variable "placebo" in your code and have to guess that might be "avalc" mainly because tx is kind of like txgroup.

jenim514
Pyrite | Level 9

@ ballardw I just tried adding tx to end of my sort, and I think this did the trick!!  Sorry, i will try to explain better next time.  But thank you!!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is ANOVA?

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.

Discussion stats
  • 2 replies
  • 1087 views
  • 0 likes
  • 2 in conversation