There is generally a stepper example in the arduino Compiler, you can find the code there, or look at the stepper library
However arduinos can‘t control steppers directly, but they send signals to stepper drivers, which then send the correct voltages to the stepper to rotate in a specific direction and rotate at a specific frequency.
Arduinos are basically ‚bit banging‘ namely they send a single high and low signal at a specific frequency and duty cycle, which determines the rotational speed of the motor itself. One line is high/low for direction, another for the signal. The advantage is you can count how many times you bit banged, and have an open loop position control system for easy NC applications
No-one would use the analog pins on an arduino to control stepper motors.
4wire stepper motors have A and B coils that require specific timing to excite (read, step) the motor and a large amperage/voltage requirement. Hence the drivers.
Considering read the wiki about steppers to get a better idea about them.