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 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 393 views
  • 0 likes
  • 2 in conversation