BookmarkSubscribeRSS Feed
csfcgua
Calcite | Level 5

t Hello,

I put a Model in Proc MCMC, and set one of the parameters as Dirichlet prior:

Proc MCMC Data=test ...... ;

   Parms Y X;

   Array X[3] x1 x2 x3;

   Array P[3] p1 p2 p3;

      Model A1 ~ normal( Y + x1, sd=1);

      Model A2 ~ normal( Y + x2, sd=1);

      Model A3 ~ normal( Y + x3, sd=1);

             

               Prior Y ~ beta(....);

               Prior X ~ Dirichlet(P);

Run;  

SAS kept telling me that "The name X is already defined as a variable and cannot be redeclared as an array by the ARRAY statement"

But if I delete the Array statement, SAS showed ERROR: The DIRICHLET distribution must be applied to an array.

This is very frustrating. Can somebody please tell me how to fix this problem? Thanks.

3 REPLIES 3
Ksharp
Super User

Then use another name

Proc MCMC Data=test ...... ;

   Parms Y X;

   Array XX[3] x1 x2 x3;

   Array P[3] p1 p2 p3;

      Model A1 ~ normal( Y + x1, sd=1);

      Model A2 ~ normal( Y + x2, sd=1);

      Model A3 ~ normal( Y + x3, sd=1);

            

               Prior Y ~ beta(....);

               Prior X ~ Dirichlet(P);

Run; 

csfcgua
Calcite | Level 5

Thanks.

But both X and P  in dirichlet must be declared as array.

charlie26
Calcite | Level 5

I ran into the same problem. Any solution? Thanks in advance!

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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