Labels including a space
Labels including a space
Dear Tom,
I want to download financial market data from yahoo directly into RATS by using the URL as a file name. The file provided is in csv format. Unfortunately, one of the data labels in the first row contains a space "Adj Close". Thus, the data of the next column "Volume" is not recognized with the correct label in the data file. To make things worse, the part of the label string right of the space sign "Close" is identical with the name of another column.
If I use the left option in the Data instruction, i could read the Volume data, however, in this case RATS ignores the Date column and does not insert NA on days the market was closed due to a holiday. Is there a way to get the data for the volume column with the right dates?
I run into a second problem. I wanted to provide a selection for which column or combination of columns the data should be read into the workspace. I used several if instructions. However, if the first if is false, then no data will be read despite a later if clause is true. I expected that if one clause is false, that no instruction before the next end if would be executed. What is going wrong?
Best regards
PeterF
I want to download financial market data from yahoo directly into RATS by using the URL as a file name. The file provided is in csv format. Unfortunately, one of the data labels in the first row contains a space "Adj Close". Thus, the data of the next column "Volume" is not recognized with the correct label in the data file. To make things worse, the part of the label string right of the space sign "Close" is identical with the name of another column.
If I use the left option in the Data instruction, i could read the Volume data, however, in this case RATS ignores the Date column and does not insert NA on days the market was closed due to a holiday. Is there a way to get the data for the volume column with the right dates?
I run into a second problem. I wanted to provide a selection for which column or combination of columns the data should be read into the workspace. I used several if instructions. However, if the first if is false, then no data will be read despite a later if clause is true. I expected that if one clause is false, that no instruction before the next end if would be executed. What is going wrong?
Best regards
PeterF
Re: Labels including a space
You can use TOP=2 to skip the labels and assign them yourself.
Re: Labels including a space
Dear Tom,
thank you for the answer. Yes, also NOLABEL and SKIPLINES=1 as options will also do the job if I want to read all columns. However, as soon as LEFT is set to a value higher than 1, then RATS no longer processes the date column. And in this case, as soon as a day has not a price due to a market holiday, the prices, from this day on, are no longer matching corresponding the trading day. Is there any hint, how RATS can solve this?
Best regards
PeterF
thank you for the answer. Yes, also NOLABEL and SKIPLINES=1 as options will also do the job if I want to read all columns. However, as soon as LEFT is set to a value higher than 1, then RATS no longer processes the date column. And in this case, as soon as a day has not a price due to a market holiday, the prices, from this day on, are no longer matching corresponding the trading day. Is there any hint, how RATS can solve this?
Best regards
PeterF