Reading of Unbalance dated data

For questions and discussion related to reading in and working with data.
irfanawan
Posts: 40
Joined: Wed Apr 01, 2015 2:12 pm

Reading of Unbalance dated data

Unread post by irfanawan »

Hello Tom,
I have an excel file with five day a week data staring from 1-1-2001 to 31-12-2014. I write the following command to load the data into RATS for analysis. The command that I used is

Code: Select all

OPEN DATA "C:\Users\Muhammad Irfan Awan\Desktop\Exchange_KSE.xlsx"
CALENDAR(D) 2001:1:1
DATA(FORMAT=XLSX,ORG=COLUMNS,SHEET="KSE_SBP_5DAYS") 2001:01:01 2014:12:31 date1 kse sbp
Then find the basic statistics for this data by
stat kse
I got the following output
Statistics on Series KSE
Daily(5) Data From 2001:01:01 To 2014:12:12
Observations 177 Skipped/Missing 3463
Sample Mean 10197.801638 Variance 51806776.049777
Standard Error 7197.692411 SE of Sample Mean 541.011691
t-Statistic (Mean=0) 18.849503 Signif Level (Mean=0) 0.000000
Skewness 0.960243 Signif Level (Sk=0) 0.000000
Kurtosis (excess) 0.706196 Signif Level (Ku=0) 0.060099
Jarque-Bera 30.878956 Signif Level (JB=0) 0.00000
What went wrong with my commands to that it give 3463 missing observations?

Another question is Is it possible to load data from excel sheet with unbalance dated data? The attached file contains the data in sheet
KSE_SBP_SAMEDAy
of irregular dates. The sheet
KSE_SBP_5DAYS
contains data with 5 days a week.

Please guide me so that I can upload my data

Thanks
Irfan
Attachments
Exchange_KSE.xlsx
(723.41 KiB) Downloaded 836 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Reading of Unbalance dated data

Unread post by TomDoan »

Your date fields are an odd collection of different styles. The first ten are numeric codings with date formats, the next thirteen are strings, then numeric codings again, etc. RATS can handle a consistent choice of one or the other, but not a single column that switches between the two.

If you're trying to skip the missing entries, read the data as "irregular" time series rather than "daily". Daily means 5-day-a-week---if Friday is missing, an NA is inserted to keep the time sequence.
irfanawan
Posts: 40
Joined: Wed Apr 01, 2015 2:12 pm

Re: Reading of Unbalance dated data

Unread post by irfanawan »

Dear Tom
I have same data in STATA format but same problem arise. The data file is attached with this post.
When I execute the command the following error on output window.
## M4. A memory request for an additional -168032 bytes cannot be satisfied


What should I do in this regards, Please guide me

Regards
Irfan
Attachments
KSE_EX_5DAYS.dta
(79.37 KiB) Downloaded 1027 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Reading of Unbalance dated data

Unread post by TomDoan »

Because the dates aren't coded as expected, you need to override the format with the DATEFORMAT option:

open data kse_ex_5days.dta
cal(d) 2001:1:1
data(format=dta,dateformat="mm-dd-yyyy") / date1 kse rate

It also reads fine if you take the cal(d) instruction out so it read as undated data.
irfanawan
Posts: 40
Joined: Wed Apr 01, 2015 2:12 pm

Re: Reading of Unbalance dated data

Unread post by irfanawan »

Dear Tom,
I want to graph this series but the dates of the data are 5 days a week but some working days are missing when I upload this file into RATS it give NA in place of missing observation on a given date. What should I do to avoid this problem also it did not read the data till the end. The data file is attached with this post. I have use the command mentioned in your previous reply to me.

Code: Select all

[ENTRY           KSE
 2001:01:02   1522.160034180
 2001:01:03   1550.420043945
 2001:01:04   1550.040039063
 2001:01:05   1545.900024414
 2001:01:08   1522.040039063
 2001:01:09   1528.310058594
 2001:01:10   1529.510009766
 2001:01:11   1504.800048828
 2001:01:12   1470.719970703
 2001:01:15        NA
 2001:01:16   1465.229980469
Attachments
Daily_KSE_Wti_Same_Day_Spot.dta
(72.41 KiB) Downloaded 1009 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Reading of Unbalance dated data

Unread post by TomDoan »

Doesn't that graph OK? It should just put a thin dash to connect lines where there would be missing values. Given the amount of data, those probably are barely visible.
Post Reply