* Dow, S&P 500 rise on factory data; European shares fall
* Dollar gains as worries about growth boost risk aversion
* Oil falls, U.S. crude stocks highest in nearly 20 years
* U.S. bond prices fall on rising U.S. equities (Recasts, updates U.S. markets; changes dateline, previous LONDON)
By Herbert Lash
NEW YORK, April 15 (Reuters) - Most U.S. stocks gained on Wednesday as better-than-expected regional factory data lifted hopes the U.S. recession may be moderating but the dollar firmed on fresh evidence the global economy is still contracting.
Falling U.S. and Spanish consumer prices added to the allure of safe-havens such as the U.S. dollar and government debt in Europe, and pressured equity markets around the world.
Persistent signs of a weak global economy in most markets lifted the aversion to risk. U.S. industrial output shrank more than expected in March and Germany's wholesale prices suffered their biggest fall in 22 years, data showed.
And China on Thursday is poised to report its slowest quarterly growth in nearly two decades, damping hopes Chinese growth can lift the rest of the world out of recession.
Corporate news also weighed on sentiment after UBS, the largest Swiss bank, reported a $1.7 billion quarter loss and thousands more job cuts, while Wal-Mart Stores Inc <WMT.N> said it does not anticipate a quick end to the U.S. recession.
A lack of clarity in Intel Corp's <INTC.O> revenue forecast led the Nasdaq to fall and raised fresh worries about corporate profits in a tough economic environment.
"There are mixed signals," said Terry Morris, senior vice president and senior equity manager for National Penn Investors Trust Co. in Reading, Pennsylvania.
"These businesses don't know what is coming through the door in the next few months -- they are as uncertain as you or I," he said.
After 1 p.m. (1700 GMT), the Dow Jones industrial average <
> was up 67.22 points, or 0.85 percent, at 7,987.40. The Standard & Poor's 500 Index <.SPX> was up 3.65 points, or 0.43 percent, at 845.15. The Nasdaq Composite Index < > was down 8.42 points, or 0.52 percent, at 1,617.30.Advancing volume on the New York Stock Exchange outpaced falling volume.
Output at U.S. factories, mines and refineries dropped 1.5 percent in March, capping a brutal quarter as businesses pared orders and cut inventory, a Federal Reserve report said.
But investors favored a separate Fed report that showed manufacturing activity in New York state contracted less severely in April, after diving to a record low the previous month.
The dollar rose against a basket of major currencies, with the U.S. Dollar Index <.DXY> up 0.16 percent at 84.93. Against the yen, the dollar <JPY=> gained 0.50 percent at 99.27.
The euro <EUR=> fell 0.28 percent at $1.3215.
"Risk aversion remains the driver for the dollar," said David Gilmore, a partner at FX Analytics in Essex, Connecticut. "When we see evidence of weakness in the economy, it promotes higher levels of risk aversion."
U.S. Treasuries retreated as most U.S. equities gained and investors took profits on a three-day bond rally.
"Stocks turning higher definitely hurt bonds, even though the economic reports were more negative than positive," said Mary Ann Hurley, vice president of fixed-income trading at D.A. Davidson & Co in Seattle.
The benchmark 10-year U.S. Treasury note <US10YT=RR> fell 6/32 in price to yield 2.81 percent. The 2-year U.S. Treasury note <US2YT=RR> fell 1/32 in price to yield 0.87 percent.
European shares closed lower, with UBS <UBSN.VX> leading banks down, while oils and miners also fell.
The FTSEurofirst 300 <
> index of top European shares fell 0.2 percent to close at 788.21 points.Euro zone government bond prices extended gains as investors concerned about the global economy sought safer assets.
Oil rose slightly but remained below $50 a barrel after U.S. crude oil stocks rose last week to their highest level in nearly two decades.
U.S. light sweet crude oil <CLc1> fell 4 cents to $49.39 a barrel.
Weekly fuel supply data from the world's top energy consumer showed a 5.6 million barrel rise in crude stocks last week, almost three times the build of 1.9 million barrels that analysts polled by Reuters had expected. [
]U.S. crude stocks last week reached 366.7 million barrels, according to the government data, the highest total since the week ended Sept. 21, 1990.
"Another week, another bearish inventory report," said Tom Bentz, senior commodity analyst at BNP Paribas Commodity Futures Inc. "It's been negative week after week and yet the market hasn't collapsed."
"It's defying fundamental logic, focusing instead on the dollar, the strength in the stock market and inflation fears -- that's what's keeping the oil price up."
Spot gold prices <XAU=> rose $2.15 to $891.00 an ounce.
Asian stocks pulled back from six-month highs. MSCI's index of Asia-Pacific stocks outside Japan <.MIAPJ0000PUS> fell 1.4 percent, and Japan's Nikkei average <
> fell 1.1 percent. (To read Reuters Global Investing Blog click on http://blogs.reuters.com/globalinvesting; for the MacroScope Blog click on http://blogs.reuters.com/macroscope; for Hedge Fund Blog click on http://blogs.reuters.com/hedgehub)(Additional reporting by Chuck Mikolajczak, Wanfeng Zhou and Pedro Nicolaci da Costa in New York; Brian Gorman, Catherine Bosley and Jane Merriman in London) (Editing by Theodore d'Afflisio)