# Parser expected when defining data

**URL:** <https://discourse.mc-stan.org/t/parser-expected-when-defining-data/34483>\
**Category:** Modeling\
**Created:** [March 13, 2024, 6:51pm UTC](https://discourse.mc-stan.org/t/parser-expected-when-defining-data/34483 "2024-03-13T18:51:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Elon\_Wu](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/elon_wu/32/18398_2.png) [@Elon\_Wu](https://discourse.mc-stan.org/u/Elon_Wu)\
**Post date:** [March 13, 2024, 6:51pm UTC](https://discourse.mc-stan.org/t/parser-expected-when-defining-data/34483/1 "2024-03-13T18:51:36Z")

</div>

Dear,

I have a simple model as below:

```no-highlight
data{
    int<lower=1> N ;
    array[N] real ce ;
    array[N] real high ;
    array[N] real p ;
}
parameters{
    real<lower=0> gamma;
    real<lower=0> delta;
    real<lower=0> sigma;
}
model{
\\auxiliary variables:
    vector[N] wp;
    vector[N] pv;
\\priors:    
    sigma ~ normal( 0.2 , 0.5 );
    delta ~ normal( 1 , 0.5 );
    gamma ~ normal( 1 , 0.5 );
\\model:    
    for ( i in 1:N ) {
        wp[i] = (delta*p[i]^gamma)/(delta*p[i]^gamma + (1-p[i])^gamma);
        pv[i] = wp[i] * high[i];
        ce[i] ~ normal( pv[i] , sigma * high[i] );
    }
}

```

It is strange that I have get the error message:

> ## parsing error:
> 
> ```
> 1: data{
> 2: int<lower=1> N;
> 3: real ce[N];
> ^
> 4: real high[N];
> 5: real p[N];
> 
> ```
> 
> ## “;” expected after variable declaration.

I believe this should be that I miss something simple, but I just could not find it. Your help will be very appreciated.

Regards,  
Elon

---

<div class="post-metadata">

**Author:** ![Bob\_Carpenter](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bob_carpenter/32/9230_2.png) [@Bob\_Carpenter](https://discourse.mc-stan.org/u/Bob_Carpenter)\
**Post date:** [March 13, 2024, 8:24pm UTC](https://discourse.mc-stan.org/t/parser-expected-when-defining-data/34483/2 "2024-03-13T20:24:03Z")

</div>

[edit: I forgot to mention—we deprecated the old array syntax in favor of the new one.]

> [@Elon\_Wu](#):
>
> `real ce[N];`

should be

```stan
array[N] real ce;

```

though I would probably make these all vectors in case I wanted to do vector operations on them, i.e.,

```stan
vector[N] ce;

```

---

<div class="post-metadata">

**Author:** ![Elon\_Wu](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/elon_wu/32/18398_2.png) [@Elon\_Wu](https://discourse.mc-stan.org/u/Elon_Wu)\
**Post date:** [March 13, 2024, 8:37pm UTC](https://discourse.mc-stan.org/t/parser-expected-when-defining-data/34483/3 "2024-03-13T20:37:30Z")

</div>

Hi, Bob

Thanks for your help.

In my model, you can see that I indeed coded as  
`array[N] real ce;` but somehow stan inherently transforms it to `real ce[N]`  
as implied by the error message.

Also, I used your suggested syntax `vector[N] ce;`, but I got a same error message.

Best,  
Jilong
