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!

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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