Page 1 of 1

Trouble with Alpha series to Svector

Posted: Sat Jul 26, 2014 12:54 pm
by abossie
I am trying to automate how my program processes a bunch of different variables. What I have done is I have set up an excel spreadsheet of my series names and labels. I want eviews to read these series names and labels for use later. I just want the name and labels in an svector, but there does not seem to be an easy way to do this. So my solution is as such:

Code: Select all

workfile .\xxx.wf1 q 1947q1 2030q4 read(b2, s=NIPA) organizeddata.xls 40 read(b2, s=business) organizeddata.xls 40 smpl 1947q1 2011q3 wfopen(s=bus_lab) .\bus.xls names=(x,y) !x=@obsrange svector(!x) name for !i= 1 to !x %hold=@elem(x, !i) name(!i)=%hold next
Then I plan on copying the string vectors over to workfile xxx. However I get the error "An unnamed object cannot converted to a string in %HOLD=@elem(x, 1). So I have two questions. 1 why am I getting this error and 2 is there an easier way to do this given that my aplha series is of different dimension/type than my xxx workfile. If you import by hand the GUI gives you the option to open a new page in the workfile and that seemed to work for adding the alpha series, but I do not see a programming option.

Re: Trouble with Alpha series to Svector

Posted: Sat Jul 26, 2014 1:21 pm
by abossie
I sloved the problem with my second question in a kind of clumsy way, but it works for me. However, I still get the "unname object error"

Code: Select all

workfile .\xxx.wf1 q 1947q1 2030q4 read(b2, s=NIPA) organizeddata.xls 40 read(b2, s=business) organizeddata.xls 40 smpl 1947q1 2011q3 pagecreate strings u 100 read(a1, s=bus_lab) .\bus.xls x $ y $ !c=0 for !y=1 to 100 if x(!y)<>"" then !c=!c+1 endif next scalar test_c=!c svector(!c) name for !i= 1 to !c %hold=@elem(x, !i) name(!i)=%hold next

Re: Trouble with Alpha series to Svector

Posted: Sat Jul 26, 2014 1:31 pm
by abossie
Ah, never mind. I found another thread that answers my question. @elem doesn't work because it returns a numeric value (?) but I did not realize that you can just access the alpha series directly so now my code is

name(!i)=x(!i)