add a analog in and serial read to the example code?

how do i read analog input to A0, and A1 and have output to D9, D2? Kinda like two pots. Im trying to reverse engineer a joysticks output to reproduce from my arduino. Pretty simple question I figured. The help in the links doesnt say much about editing already written code. am I missing something? Thanks guys

const int analogInPin = A0;
const int analogOutPin = 9;

// Analog output pin that the LED is attached to

int sensorValue = 0; // value read from the pot
int outputValue = 0; // value output to the PWM (analog out)

  analogWrite (analogOutPin, analogRead (analogInPin) >> 2) ;

or

  sensorValue = analogRead (analogInPin) ;
  outputValue = sensorValue >> 2 ;
  analogWrite (analogOutPin, outputValue) ;

or

  sensorValue = analogRead (analogInPin) ;
  outputValue = map (sensorValue, 0, 1023, 0, 255) ;
  analogWrite (analogOutPin, outputValue) ;