Transforming numerical series into alpha or svector
Posted: 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:
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
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
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