Transforming numerical series into alpha or svector

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

michel
Posts: 9
Joined: Mon Feb 01, 2021 4:11 am

Transforming numerical series into alpha or svector

Postby michel » Wed Jun 09, 2021 1:48 am

Dear Support,

I need to convert a numerical series into a string in order to find the unique values in the series. Later in the progam I still need it to be a string.
Currently I use a simple loop to do the transformation:

Code: Select all

   
   %codepays_all =""
   for !i = 1 to @obs(codepays)
      %codepays_all = %codepays_all +" "+@str(codepays(!i))
   next
   string codepays_all = %codepays_all
   %codepays_unique = @wunique(codepays_all)
   string codepays_unique =  %codepays_unique


However, the series codepays has 160000 observations and the loop takes some minutes to run (I have to run this multiple times for similar variables).

Now my question is, is there a faster way to perform this transformation? Ideally I could convert the series codepays into an svector or alpha and from there on use @wjoin to convert it into a string (such that I can use @wunique).

Kind regards,

michel

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

Re: Transforming numerical series into alpha or svector

Postby EViews Gareth » Wed Jun 09, 2021 6:18 am

Follow us on Twitter @IHSEViews

michel
Posts: 9
Joined: Mon Feb 01, 2021 4:11 am

Re: Transforming numerical series into alpha or svector

Postby michel » Wed Jun 09, 2021 9:01 am

Thank you very much!

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

Re: Transforming numerical series into alpha or svector

Postby EViews Gareth » Wed Jun 09, 2021 9:20 am

Probably a bit faster :D
Follow us on Twitter @IHSEViews

michel
Posts: 9
Joined: Mon Feb 01, 2021 4:11 am

Re: Transforming numerical series into alpha or svector

Postby michel » Thu Jun 10, 2021 3:07 am

Its no comparision. :)
Considering the transformation of a vector into an svector, is there any function I could use? Currently I do it as shown in my first post on the current topic.

Ideally this would work:

Code: Select all

vector codepaysorigine_unique = @uniquevals(codepaysorigine)
svector codepaysorigine_unique_sv = @str(codepaysorigine_unique)



Kind regards,

michel

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

Re: Transforming numerical series into alpha or svector

Postby EViews Gareth » Thu Jun 10, 2021 7:29 am

Not currently.
Follow us on Twitter @IHSEViews


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 20 guests