Technology shares pushed the Nasdaq lower on Friday after National Semiconductor's disappointing outlook, but a climb in defensive sectors like pharmaceuticals lifted the Dow industrials and S&P 500.

Dow industrials close positive for year.

Main indexes score gains for the week.

The Dow Jones industrial average <.DJI> gained 28.34 points, or 0.32 percent, to close unofficially at 8,799.26. The Standard & Poor's 500 Index <.SPX> rose 1.32 points, or 0.14 percent, to end unofficially at 946.21. The Nasdaq Composite Index <.IXIC> dropped 3.57 points, or 0.19 percent, to finish unofficially at 1,858.80.

For the week, the Dow was up 0.4 percent, the S&P 500 gained 0.7 percent and the Nasdaq added 0.5 percent.

(Reporting by Rodrigo Campos; Editing by Jan Paschal)