Using a series that's assigned inside a procedure

Use this forum to post questions about syntax problems or general programming issues. Questions on implementing a particular aspect of econometrics should go in "Econometrics Issues" below.
macro
Posts: 70
Joined: Thu Jul 16, 2015 3:01 pm

Using a series that's assigned inside a procedure

Unread post by macro »

I have a procedure that builds a dataset and returns it as a hash[series]. Outside the procedure, I can access the dataset by referring to the hash directly, but if I try to set a series using those data, the set statement returns a series with no data. For example

Code: Select all

calendar(q) 1950 1
allocate 2010:4

procedure builddata
    option integer beginsamp 1969:1
    option integer endsamp 2002:4
    declare hash[series] %data
    set %data("c") beginsamp endsamp = t
end

@builddata
statistics %data("c")
set s = %data("c")
statistics s
outputs

Code: Select all

calendar(q) 1950 1
allocate 2010:4

procedure builddata
(01.0008)     option integer beginsamp 1969:1
(01.0027)     option integer endsamp 2002:4
(01.0046)     declare hash[series] %data
(01.0046)     set %data("c") beginsamp endsamp = t
(01.0099) end

@builddata
statistics %data("c")

Statistics on Series
Quarterly Data From 1969:01 To 2002:04
Observations                   136
Sample Mean             144.500000      Variance                1552.666667
Standard Error           39.403892      SE of Sample Mean          3.378856
t-Statistic (Mean=0)     42.765956      Signif Level (Mean=0)      0.000000
Skewness                  0.000000      Signif Level (Sk=0)        1.000000
Kurtosis (excess)        -1.200000      Signif Level (Ku=0)        0.005378
Jarque-Bera               8.160000      Signif Level (JB=0)        0.016907

set s = %data("c")
statistics s

Statistics on Series S
Quarterly Data From 1950:01 To 2010:04
Observations                   244
Sample Mean               1.000000      Variance                   0.000000
Standard Error            0.000000      SE of Sample Mean          0.000000
t-Statistic (Mean=0)            NA      Signif Level (Mean=0)            NA
Referring to %data("c") works just fine, so I know that's working, but why isn't the SET instruction working? As a bit of background, I use a procedure like this to build a dataset once (and therefore only read the component datasets from the filesystem once), and then use that dataset in another procedure that requires numerous iterations.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Using a series that's assigned inside a procedure

Unread post by TomDoan »

Don't you have a newer build of version 9? That's been fixed for months.
macro
Posts: 70
Joined: Thu Jul 16, 2015 3:01 pm

Re: Using a series that's assigned inside a procedure

Unread post by macro »

I have a fixed term build of v9 but that expired months ago. I haven't received any newer, licensed versions of RATS from IT, apart from the original v9.00, but I'll verify that with the IT staff. Was this the same bug that was fixed after this thread? https://estima.com/forum/viewtopic.php?f=13&t=2423
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Using a series that's assigned inside a procedure

Unread post by TomDoan »

Yes. The "handles" for the series out of hashes weren't being processed correctly.
macro
Posts: 70
Joined: Thu Jul 16, 2015 3:01 pm

Re: Using a series that's assigned inside a procedure

Unread post by macro »

Thanks; our IT department confirmed that the latest licensed version we have is 9.00 non-beta. Is there a newer version that we should be using that isn't a beta or fixed-term version?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Using a series that's assigned inside a procedure

Unread post by TomDoan »

We've had a newer build available since October.
PeterF
Posts: 63
Joined: Thu Apr 12, 2012 2:03 pm

Re: Using a series that's assigned inside a procedure

Unread post by PeterF »

Dear Tom,

maybe you could provide some information in the forum (RATS Product Announcement) if a new build will be released. I was one of the beta testers of the recent build released in October and had to contact support to get the information and a link to download latest build of version 9.0.

Best regards
Peter
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Using a series that's assigned inside a procedure

Unread post by TomDoan »

The newer build (9.00g for Windows) is at the same link as was used before.
Post Reply