From the question formulation I am not sure what is the desired end result: a time series or a table. It seems to be the latter but I give solutions for both.

I am using a sample of the stocks for clarity.

```
stdate = "04/21/1982";
enddate = "10/31/2014";
rSP = {"ADP", "ALL", "CNP", "ED", "EMR", "EXPD", "FB", "FLIR", "HAR",
"NEE", "OKE", "PHM", "PLD", "PX", "WAT", "XYL"};
```

Read the stocks time series:

```
mystock =
Table[TimeSeries[FinancialData[rSP[[i]], {stdate, enddate}]], {i,
Length[rSP]}];
```

## Merge into a single time series object

Get the time paths of each time series and covert each path into a list of date->value rules:

```
dateValRules =
Table[Dispatch[
Append[Rule @@@ mystock[[i]]["Path"], _?NumberQ -> 0]], {i,
Length[mystock]}];
```

Create the full set of dates:

```
dr = DateRange[stdate, enddate];
drt = AbsoluteTime /@ dr;
```

Create the combined time series object:

```
combTS = TimeSeries[Transpose@Map[drt /. # &, dateValRules], {drt}];
```

Plot:

```
DateListPlot[combTS, PlotRange -> All, Joined -> False,
PlotTheme -> "Detailed"]
```

## Table of dates vs stock values

The code below makes table with rows corresponding to the dates and columns corresponding to the stock IDs.
Put the stocks data into a large list of triplets {id, date, value}:

```
allStock =
Join @@ Table[
Flatten /@ Thread[{rSP[[i]], mystock[[i]]["Path"]}], {i,
Length[mystock]}];
```

Next we convert into a sparse matrix. For this we corresponding mapping to indices.

```
dr = DateRange[stdate, enddate];
stockNameToIndexRules = Dispatch@Thread[rSP -> Range[Length[rSP]]];
dateToIndexRules =
Dispatch@Thread[(AbsoluteTime /@ dr) -> Range[Length[dr]]];
```

Verify that all dates are indexed:

```
Complement[allStock[[All, 2]], Normal[dateToIndexRules][[All, 1]]]
(* Out[444]= {} *)
```

Make the sparse matrix:

```
arules = Map[Most[#] -> Last[#] &,
allStock /. stockNameToIndexRules /. dateToIndexRules];
smat = Transpose@
SparseArray[arules,
{Length[Normal@stockNameToIndexRules], Length[Normal@dateToIndexRules]},
"NA"];
```

(Note that I put "NA" as the implicit value.)

Tabulate a sample of the sparse matrix:

```
TableForm[Normal[smat[[2000 ;; 2030, All]]],
TableHeadings -> {DateString[#, {"Day", ".", "Month", ".", "Year"}] & /@ Normal[dateToIndexRules][[All, 1]],
Normal[stockNameToIndexRules][[All, 1]]}]
```

We can re-create the sparse matrix with the implicit value being 0 and plot the row sums:

```
smat0 =
Transpose@
SparseArray[
arules, {Length[Normal@stockNameToIndexRules], Length[Normal@dateToIndexRules]}]
(* Out[448]= SparseArray[< 95387 >, {11882, 16}] *)
DateListPlot[Transpose[{dr, Total /@ smat0}], PlotTheme -> "Detailed", Joined -> False]
```

Maybe use quandl ? See my answer here http://mathematica.stackexchange.com/a/46761/66

– faysou – 2014-11-11T07:43:17.157@ faysou, thanks for your comment. I have seen your post. Its pretty cool. I put this question to have more options in downloading data using built-in Mma function. At the same time, it also helps to learn how to merge unequal time series data. – ramesh – 2014-11-11T15:04:04.973

@rka I don't know what you are using this for but keep in mind that the members of the S&P500 have changed over time. So I'm not certain if you're going to get what you think you have gotten at the end of this exercise. – Edmund – 2014-11-11T16:12:09.970

@ Edmund, you are absolutely right. The members of S&P500 keep on changing. But this is an example. If we can make it work, we can change the symbols or even add more symbols and have all prices in one file. Then we can analyze stocks using other powerful Mma functions. – ramesh – 2014-11-11T18:26:55.087

@ramesh, ironically, my concern coincided with yours but I never thought of to deal with S&P data. I cannot download it with your code to check but some useful methods you may find in the question. If you will make it successfully, you may post your anwer here - it would be nice to read.

– garej – 2016-01-25T18:05:17.597@ garej, I have done my work but the code is not neat. I will try to post later. Thanks – ramesh – 2016-01-26T19:37:18.143

@ramesh, that is fine: note that if you make a space between

`@`

and`nickmane`

in comment or post, you adressee will not get any notification. they should be stick together. I came here just occasionally, not knowing that you post something... – garej – 2016-01-26T20:54:41.677