# Is it possible to check if Variable is in YAXArray Dataset?

**URL:** https://discourse.julialang.org/t/is-it-possible-to-check-if-variable-is-in-yaxarray-dataset/133378
**Category:** New to Julia
**Tags:** question
**Created:** [October 23, 2025, 9:46am UTC](https://discourse.julialang.org/t/is-it-possible-to-check-if-variable-is-in-yaxarray-dataset/133378 "2025-10-23T09:46:43Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Kamil\_Mroz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kamil_mroz/32/218009_2.png) [@Kamil\_Mroz](https://discourse.julialang.org/u/Kamil_Mroz)
#### Post date: [October 23, 2025, 9:46am UTC](https://discourse.julialang.org/t/is-it-possible-to-check-if-variable-is-in-yaxarray-dataset/133378/1 "2025-10-23T09:46:43Z")

</div>

Hi, as in the title, is it possible to check if Variable is in YAXArray Dataset? currently I do:

```julia-auto
         try      
            ds = YAXArrays.Dataset(; ds.cubes..., b = function_1.(ds["a"]))
        catch e
            println("Error: ", e)
        end

```

to check if variable is in the dataset and perform some computations if that is the case.

---

<div class="post-metadata">

### Author: ![eldee](https://avatars.discourse-cdn.com/v4/letter/e/b5a626/32.png) [@eldee](https://discourse.julialang.org/u/eldee)
#### Post date: [October 23, 2025, 1:37pm UTC](https://discourse.julialang.org/t/is-it-possible-to-check-if-variable-is-in-yaxarray-dataset/133378/2 "2025-10-23T13:37:52Z")

</div>

Hi, you could use `haskey(ds.cubes, :a)` or `hasproperty(ds, :a)`, though the latter also returns `true`for the axis names.
