1997 Altima idle/stalling problems

Unfortunately there is but a guessing game to do without codes or specific conditions.

You do mention the possibility of moisture being involved (raining/humidity). The next time the weather is clear and dry, start it up, pop the hood, and use a misting-type spray bottle with water in it to mist the spark plug wires. Follow the wires to whatever they are connected to (coil or distributor cap) and mist that too. If you get any engine stumble associated with the misting then your problem is with whatever component acts up when misted. You can mask certain components at different times to isolate it.

Other than that it sounds like an intermittent vacuum leak. The things that come to mind would be an evaporative emissions purge solenoid or an EGR valve that sticks open. Another thing could be an idle air control valve (IAC) that is getting sticky or has a bad connection. I’m sure there are other things. Does it ever seem to be associated with having the brakes on or off?

For $20 you can buy a Haynes or Chiltons repair manual at an auto parts store. This will tell you, for example, where all of those components I just mentioned are and how you can test them. I would certainly check the wiring to the IAC and pull it off for a good cleaning. In addition to the manual you will need a multimeter for electrical testing. You can get these as low as $10 (though for long term utility I would spend at least $20).

As oltimer 11 said - a cleaning of throttle body also can’t hurt and is cheap and easy.

You should also cross your fingers that this eventually triggers the check engine light - at which point the codes will point you to the diagnostic steps.