something like str2num ?

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

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

alex7312
Posts: 6
Joined: Mon Dec 01, 2014 2:30 pm

something like str2num ?

Postby alex7312 » Thu Dec 04, 2014 2:19 pm

1 I have a series with numbers stored as string (for some reason that is how they were imported from xls / although in xls they are stored as numbers).
How to convert the whole series in number format?

Otherwise I receive the following info: "alpha series in specification DUM_POZICIJA (name of my problematic series) @expand can convert to categorical dummies"

2 The series was made with the program>
smpl @all

alpha dum_pozicija="4"

dum_pozicija= @recode(poz01 ="18" or poz01="23","1",dum_pozicija)
dum_pozicija= @recode(poz01 ="1" or ...,"2",dum_pozicija)
etc...

But if I tried to use numbers (4) instead of strings ("4") I receive a message "cannot assign numeric expression to string variable in "alpha dum_pozicija=4".
Can I somehow define numbers in the above program?

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

Re: something like str2num ?

Postby EViews Gareth » Thu Dec 04, 2014 2:32 pm

@val

alex7312
Posts: 6
Joined: Mon Dec 01, 2014 2:30 pm

Re: something like str2num ?

Postby alex7312 » Thu Dec 04, 2014 3:04 pm

thanks!
Suppose it refers to second part?
It does not refer to converting the whole series to numbers? Because if I apply to whole series @val(nameofseries) it returns numbers and n/a...

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

Re: something like str2num ?

Postby EViews Gareth » Thu Dec 04, 2014 3:34 pm

@val will convert a whole alpha series, or a single character, into a number. Any text that doesn't represent a number will be converted into an NA.


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests