I'm not a Subaru expert, but some reasons for stalling include a dirty TB, bad cam/crank sensors, bad IACV, clogged fuel filter...
You said leaving the key to the run position for 30 sec helped it start, which may indicate a fuel issue.
Is the CEL on? When you turn the key to run, do you hear the fuel pump prime?
Edited by mclasser (12/11/17 11:32 AM)
2018 Hyundai Elantra VE -- 3K
2013 Honda Pilot EX-L 4WD -- 55K
2002 Honda Accord EX-L -- 210K