repeat alpha series

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator

metrix
Posts: 57
Joined: Sun Dec 08, 2013 9:15 am

repeat alpha series

Postby metrix » Wed May 03, 2017 8:25 am

hi
i have two workfile:
workfile 1 with: page one by frequency month 12 years, second page unstructured 30 obs
i have use alpha month=" January February....December" to make reapeat with monthly, but no! all value month(1)= January February....December.
same with my unstructured page 10 alpha, alpha name="california Florida New York Wisconsin Delaware Kansas Illinois North Dakota South Dakota Texas"
i would like reapt alpha series like this:
January
February
March
....
January
.....

for undated seris:
california
...
Texas
california
...
second workfile 2 panel(monthly): i have crossid from 1 to 7 "inf, gdp, irate, exchange, M1, usd, euro"
how can change 1 by "inf", 2 by "gdp" ...., i can create a new Alpha series to create idenification with the names this manually take long time and fill them too.
could help me to solve this

startz
Non-normality and collinearity are NOT problems!
Posts: 3775
Joined: Wed Sep 17, 2008 2:25 pm

Re: repeat alpha series

Postby startz » Wed May 03, 2017 8:42 am

something like

Code: Select all

smpl 13 @last
y = y(-12)
smpl @all

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13307
Joined: Tue Sep 16, 2008 5:38 pm

Re: repeat alpha series

Postby EViews Gareth » Wed May 03, 2017 8:43 am

Problem 1:
(Note the first page could be done using date functions much more simply, but since you want to do the second page too, I'll show you the general solution)

Code: Select all

%list = "January February March April May June July August September October November December"
!num = @wcount(%list)
for !i = 1 to !num
   smpl if @mod(@trend,!num)=!i-1
   alpha mymonths = @word(%list,!i)
next



Problem 2:
You'll have to describe it more clearly.
Follow us on Twitter @IHSEViews

metrix
Posts: 57
Joined: Sun Dec 08, 2013 9:15 am

Re: repeat alpha series

Postby metrix » Wed May 03, 2017 9:09 am

I forgot to thank you Mr Gareth and Mr starz :oops: sorry.
1/ how can do this by function in monthly could you show me please. ( i have puting "_" for the unstructured page).
2/ i have 7 crossid. i would like to change 1 by inf
1 - 80m01 would be inf -80m01
1- 80m02 would be inf -80m02
.....
2 - 80m01 would be 1 -80m01
2- 80m02 would be 1 -80m02

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13307
Joined: Tue Sep 16, 2008 5:38 pm

Re: repeat alpha series

Postby EViews Gareth » Wed May 03, 2017 9:19 am

1) Use the @datestr function

2) Same idea:

Code: Select all

%list = "inf gdp foo goo hoo boo doo"
for !i=1 to 7
smpl if @crossid=!i
alpha myalpha = @word(%list,!i)
next
Follow us on Twitter @IHSEViews

metrix
Posts: 57
Joined: Sun Dec 08, 2013 9:15 am

Re: repeat alpha series

Postby metrix » Wed May 03, 2017 9:25 am

i get error message Error in Sample: DATESTR is not defined in "SMPL IF DATESTR=1-1".
%list = "January February March April May June July August September October November December"
!num = @wcount(%list)
for !i = 1 to !num
smpl if datestr=!i-1
alpha mymonths = @word(%list,!i)
next

startz
Non-normality and collinearity are NOT problems!
Posts: 3775
Joined: Wed Sep 17, 2008 2:25 pm

Re: repeat alpha series

Postby startz » Wed May 03, 2017 9:26 am

@ sign

metrix
Posts: 57
Joined: Sun Dec 08, 2013 9:15 am

Re: repeat alpha series

Postby metrix » Wed May 03, 2017 9:28 am

error messge Error in Sample: Incorrect number of arguments for @DATESTR function in "SMPL IF @DATESTR=1-1".

startz
Non-normality and collinearity are NOT problems!
Posts: 3775
Joined: Wed Sep 17, 2008 2:25 pm

Re: repeat alpha series

Postby startz » Wed May 03, 2017 9:35 am

You need to give arguments to the @datestr function. Take a look in the Help system.

metrix
Posts: 57
Joined: Sun Dec 08, 2013 9:15 am

Re: repeat alpha series

Postby metrix » Wed May 03, 2017 9:44 am

@datestr(x,"m") Than what I put in the place x

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13307
Joined: Tue Sep 16, 2008 5:38 pm

Re: repeat alpha series

Postby EViews Gareth » Wed May 03, 2017 9:44 am

@date
Follow us on Twitter @IHSEViews

metrix
Posts: 57
Joined: Sun Dec 08, 2013 9:15 am

Re: repeat alpha series

Postby metrix » Wed May 03, 2017 9:48 am

Error in Sample: Numeric operator applied to string data in"SMPL IF @DATESTR(@DATE,"M")=1-1".
%list = "January February March April May June July August September October November December"
!num = @wcount(%list)
for !i = 1 to !num
smpl if @datestr(@date,"m")=!i-1
alpha mymonths = @word(%list,!i)
next

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13307
Joined: Tue Sep 16, 2008 5:38 pm

Re: repeat alpha series

Postby EViews Gareth » Wed May 03, 2017 10:03 am

show @DATESTR(@DATE,"M")
Follow us on Twitter @IHSEViews

metrix
Posts: 57
Joined: Sun Dec 08, 2013 9:15 am

Re: repeat alpha series

Postby metrix » Wed May 03, 2017 10:11 am

I thought it was by loop, sorry for the inconvenience.
thanks you Mr Gareth and Mr startz.


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 17 guests