BookmarkSubscribeRSS Feed
Olanike
Fluorite | Level 6

Please I have my data in excel and I am using macro statements as shown below. I have my macros to analyze YieldB, YieldC and YieldW (which is working fine). Now I will like to see if there is an interaction between each of these yields and other variables that I have in the excel sheet.

 

For instance how do I have an interaction statement like YieldB X MeanT and where exactly should it be in the code

 

My code is below:

proc print;
proc sort data=C_YieldM;
by Trial;

/* Running Factorial Design without Rep effect but with day effect, The Covtest provides the covariance parameter estimates*/
%macro Rotation (var=);
proc mixed data=C_YieldM;
*By Year;
class Rep Trial T_System;
model &var=T_System;
random Rep(Trial) Trial Trial*T_System/solution;
repeated Trial/subject=rep*T_System type=ar(1) RCORR;
Lsmeans T_System/diff=all;

/* Contrasts statement for the management practice */
estimate 'IRR_RF' T_System 1 -1;
ods output diffs=table;
ods output lsmeans=Mylsmeans;
Store Mylsmeans;

data calc_lsd;
set table;
lsd=stderr*tinv(1 -(0.05/2), df);
run;

proc print data=calc_lsd;
*var lsd estimate stderr df;
run;

proc plm restore=Mylsmeans;
lsmeans T_System/pdiff adjust=tukey lines alpha=0.05;
run;

%mend Rotation;

%Rotation (var=YieldB);
%Rotation (var=YieldC);
%Rotation (var=YieldW);

run;

3 REPLIES 3
Tom
Super User Tom
Super User

Looks to me like you are using PROC MIXED.

So look at the manual for PROC MIXED.

 

Once you understand what code you want to run THEN you can think about to use a macro to generate that code.

Olanike
Fluorite | Level 6

Thanks Tom. I can do the interaction if I used card input, but I have been using macro (with my data in excel) but where to fit in my interaction statement is my concern. Thanks you

Tom
Super User Tom
Super User

@Olanike wrote:

Thanks Tom. I can do the interaction if I used card input, but I have been using macro (with my data in excel) but where to fit in my interaction statement is my concern. Thanks you


That makes no sense to me. A CARDS statement is something you would use in a DATA step. An interaction is something you would specify in some statistical proc.  How you read the data makes no difference once you already have the dataset and are running a PROC.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 3 replies
  • 730 views
  • 0 likes
  • 2 in conversation