Prior distribution for parameter

How could I define the prior distribution for following parameter sigma in rstan?

  for (j in 1:p1){
    
    sigma1[j]=sqrt(var1[j]);
    var1[j]~gamma(1,0.1);
  }

This snippet already defines a prior distribution on sigma1 using valid Stan code. I think I must be missing the main message of your question. Could you clarify?

I want to use the root of gamma distribution as prior distribution for sigma1. But it shows cannot assigned to variable outside of declaration block:

data {
int<lower=0> N;
vector[N] y;
}

// The parameters accepted by the model. Our model
// accepts two parameters ‘mu’ and ‘sigma’.
parameters {
real mu;
real<lower=0> sigma;
}

// The model to be estimated. We model the output
// ‘y’ to be normally distributed with mean ‘mu’
// and standard deviation ‘sigma’.
model {
real var1;
y ~ normal(mu, sigma);
var1~gamma(1,1);
sigma=sqrt(var1);

}

Declare the parameter var1 in the parameters block and remove the declaration of parameter sigma. Then, move the line sigma=sqrt(var1) to the very beginning of the model block.

It does work now. Thank you very much.