Need help setting a variable reference value in setup and use it in loop

Hi Im trying to write a sketch to build a arduino nano, 0-5v pressure sensor.

the issue I have is that the sensor reads from 0 bar to 3 bar but ground level atmosphere is 1 bar but boost pressure is any pressure above atmosphere so 1 bar of boost the sensor will actually read 2 bar.

So what i want to do is use the pressure sensor in the setup phase and read and save a reference value that will be at atmospheric pressure and use that reference as part of the loop. In the loop I will use the same sensor to read the boost pressure and use the atmospheric pressure value as the low isde of the map and the current pressure value will be the high side of the map the mapped value is what will be used for display.

I can get the reference value to hold from the setup to the loop, Is there a way to save the value in the setup and use it in the loop? at the moment the reference value is changing during the loop.

int refval;
int mapref;
int bval ;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200); //start serial connection

  #define mapref analogRead(0) // Trying to set a reference value for atmospheric this will change with altitude and weather

  Serial.print("Map Reference value: ");
  Serial.println(mapref);
  delay (2000);
}

void loop() {
  // put your main code here, to run repeatedly:
  
  refval = analogRead(0);
  Serial.print("Map Reference value: ");
  Serial.println(mapref);
  Serial.print("RefVal: ");
  Serial.println(refval);
  if (refval >= mapref)
  {
    int bval = analogRead(A0);
    bval = map(bval, mapref, 902, 0, 120); // the mapped value will be used to control gauge
    Serial.print("BVAL MAPPED: ");
    Serial.println(bval);
  }
  delay (1000);
}

replace

int mapref;
[...]
  #define mapref analogRead(0) // Trying to set a reference value for atmospheric this will change with altitude and weather

with

  int mapref = analogRead(0); // Set a reference value for atmospheric this will change with altitude and weather

instead of #define mapref analogRead(0)

I think what you actually need is mapref=analogRead(0);

since you have already declared 'int mapref;' before 'setup()'

hope that helps....

Thank you for the help that sorted it