Question: I', trying to run this functin only on mobile devices which is less than 768px , it works on this screen width but it also ignore the condition and works on larger screens than 768px, i tried to clear interval but there is something wrong with my code

```js
  $(document).ready(function () {
 $(window).on("resize", function (e) {
                   checkScreenSize();
                   clearInterval(intervalId)
               });

               checkScreenSize();

               function checkScreenSize() {
                   var newWindowWidth = $(window).width();
                   if (newWindowWidth < 768) {
                       const divs = [...document.querySelectorAll(".tagline2")];

                       divs.i = 0;
                       intervalId = setInterval(function () {
                           divs[divs.i++].classList.remove("move");
                           divs[divs.i = divs.i % divs.length].classList.add("move")
                       }, 3000);

                   }

               }
           });
```

```css
.move {background-color:red}
```

```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="infobarContainer">
  <div class="tagline tagline2 move">
    USP 1
  </div>
  <div class="tagline tagline2">
    USP 2
  </div>
  <div class="tagline tagline2">
    USP 3
  </div>
  <div class="tagline tagline2">
    USP 4
  </div>
</div>
```

Answer: 
If you want to use it later you create it in a macro variable and reference it later with a &variableName

Let's assume:

* data set name is myDataset
* variable name is value
* Single observation/row in the data set
* Macro variable output name is myValue

```
*create fake data;
data myDataset;
date = mdy(7, 18, 2022);
format date ddmmyyn8.;
value = 15;
output;
run;

```

```
data _null_; *_null_ means SAS will not create a data set as output;
set myDataset; *indicate the input data set;
call symputx('myValue', value, 'g'); *create the variable with a global scope;
run;

```

Then to use it later, say filter all people under the age of myValue.

```
data below15;
set sashelp.class;
where age <= &myValue;
run;

```

Here is more references on Macro variables.
<https://stats.oarc.ucla.edu/sas/seminars/sas-macros-introduction/>

Generally speaking though, avoiding macros at the beginning is recommended. You should code without macros as much as possible. There are often other ways of doing things.
SAS does not have any "global variables". All variables live in datasets. If you want to use a value from the first observation of one dataset in a data step that is using some other dataset as its main input then just read it in once at the start of the data step and its value will stay the same for the whole data step.

To change the variable's name from column\_name to last\_dat\_value you can use the RENAME= dataset option.

```
data want;
  if _n_=1 then 
    set RWORK.dataset(keep=column_name rename=(column_name=last_dat_value) obs=1)
  ;
  set have;
  days_till_last = last_dat_value - date ;
run;

```