@uniquevals excludes spaces?

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

chester
Posts: 44
Joined: Thu May 12, 2016 11:14 am

@uniquevals excludes spaces?

Postby chester » Thu Oct 13, 2016 7:53 am

Hi I'm using the @uniquevals command in order to read repetitive values in an Excel column into an EViews list, which shows up in a drop-down list from a pop up window (in EViews).

The problem is that if the cell contains two words separated by a space, it interprets the two words as if they are unique values. For example, "Price Indexes" gets interpreted as "Price" in one list option, an "Indexes" as the following option.

Is there any way to work around this? I've attached a screenshot illustrating my issue. Thanks in advance! :)
eviewsrequest.PNG
eviewsrequest.PNG (25.88 KiB) Viewed 4190 times

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

Re: @uniquevals excludes spaces?

Postby EViews Gareth » Thu Oct 13, 2016 8:09 am

You'll have to provide more information.

chester
Posts: 44
Joined: Thu May 12, 2016 11:14 am

Re: @uniquevals excludes spaces?

Postby chester » Thu Oct 13, 2016 12:26 pm

So 'group' is a column in my Excel file. It contains only strings. Sometimes two words.
For example, in one cell, it may contain the value "One word" but in the EViews pop-up list, "One" shows up in a separate line as "word".
This is the problematic section of my code.

Code: Select all

svector uniquegroups =@uniquevals(group) for !j=1 to @rows(uniquegroups) list = list + " " +uniquegroups(!j) next scalar result=0 @uidialog( "List", result, "Choose the data to be updated", list) if(result==0) then stop endif

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

Re: @uniquevals excludes spaces?

Postby EViews Gareth » Thu Oct 13, 2016 12:45 pm

The issue has nothing to do with @uniquevals. Indeed, I'm willing to bet that if you open up the svector containing the values, you'll see it worked just fine.

The issue is with the way you're building up your string.

Rather than do it manually, you're probably better off using the built in function:

Code: Select all

svector uniquegroups =@uniquevals(excelstuf) list = @wjoin(uniquegroups) scalar result=0 @uidialog( "List", result, "Choose the data to be updated", list) if(result==0) then stop endif

chester
Posts: 44
Joined: Thu May 12, 2016 11:14 am

Re: @uniquevals excludes spaces?

Postby chester » Thu Oct 13, 2016 12:57 pm

That worked wonderfully. I was not aware of that built-in function.
Thanks!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests