BookmarkSubscribeRSS Feed
luinkhandakar
Calcite | Level 5

If I want to know whether the new marketing campaign has increased sales. There are 147 stores that used the new social media marketing strategy and 1,112 that did not.

 

PROC ANOVA DATA = mkt ;

 CLASS campaign ;

MODEL sales1 sales2 = campaign / NOUNI ;

REPEATED market 2 (1 2) ;

 

Is the code write? What am I doing wrong here?

5 REPLIES 5
Kurt_Bremser
Super User

I moved this to the Statistical Procedures community, and edited the subject line. "SAS Coding" in the SAS communities is not descriptive at all, because most of the traffic here deals with that.

 

By supplying usable source/example data (see your other post), you will make it easier to check your code.

PaigeMiller
Diamond | Level 26

@luinkhandakar wrote:

If I want to know whether the new marketing campaign has increased sales. There are 147 stores that used the new social media marketing strategy and 1,112 that did not.

 

PROC ANOVA DATA = mkt ;

 CLASS campaign ;

MODEL sales1 sales2 = campaign / NOUNI ;

REPEATED market 2 (1 2) ;

 

Is the code write? What am I doing wrong here?


Why do you think anything is wrong here? Show us what is wrong. Show us the log where there are errors (the entire log for PROC ANOVA including the code, the ERRORs, the NOTEs and the WARNINGs), or show us the output and explain why it isn't right.

--
Paige Miller
SteveDenham
Jade | Level 19

PROC ANOVA is designed for balanced data, which is not the case for your situation. PROC GLM is probably better (and even better PROC MIXED).

 

One key is that your data be structured with sales1 value, sales2 value, and the market variable indicator named as 'campaign' for each record.  Then try:

 

PROC GLMA DATA = mkt ;
 CLASS campaign ;
MODEL sales1 sales2 = campaign / NOUNI ;
REPEATED campaign 2 (1 2) ;
QUIT:

PROC MIXED would be better suited to interpretation than the multivariate results of PROC GLM (or PROC ANOVA).  First you would need to restructure your data to a long format, and then analyze.  PROC GLIMMIX was chosen over PROC MIXED to get the slicediff option  This should work:

 

data mktlong;
set market;
value=sales1; sales=1; output;
value=sales2; sales=2; output;
drop sales1 sales2;
run;

proc glimmix data=mktlong;
class campaign sales store;
model value=sales campaign sales*campaign;
random sales/subject=store residual;
lsmeans sales campaign;
lsmeans sales*campaign/slicediff=campaign;
run;

SteveDenham

 

 

 

 

PaigeMiller
Diamond | Level 26

I agree with you @SteveDenham except this part:

 

PROC ANOVA is designed for balanced data, which is not the case for your situation.

which is an incomplete statement of what PROC ANOVA does. The documentation clearly says it also works for one-way ANOVA which is an exception to the requirement of balance.

 

Use PROC ANOVA for the analysis of balanced data only, with the following exceptions: one-way analysis of variance, Latin square designs, certain partially balanced incomplete block designs, completely nested (hierarchical) designs, and designs with cell frequencies that are proportional to each other and are also proportional to the background population. These exceptions have designs in which the factors are all orthogonal to each other.

 

 

--
Paige Miller
SteveDenham
Jade | Level 19

That is an excellent point @PaigeMiller .I guess I don't think of repeated measures as a one-way analysis, so I got a bit fast and loose about the reasons to avoid PROC ANOVA.  I think the OP has two names for the same thing - campaign and market, which may be the cause of the problem.

 

SteveDenham

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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
  • 5 replies
  • 1032 views
  • 1 like
  • 4 in conversation