removing spaces from string created using @winterleave

For questions regarding programming in the EViews programming language.

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

BT454
Posts: 44
Joined: Wed Aug 02, 2017 6:07 am

removing spaces from string created using @winterleave

Postby BT454 » Fri Apr 05, 2019 11:06 am

Hi!
I have interwoven two strings using the winterleave command. However, there is a space between the components of each interwoven pairing. I have tried the ltrim and rtrim to remove these spaces, but it didn't work. Also, I have checked the original strings to look for extra spaces and I could not find any. Is there another way to remove them?
I have attached the workfile, and the code for your reference.
The I would like to remove the spaces in the middle of each paired object from the string custids (i.e. CALCASIEU 4095 cIND098 3275 --> CALCASIEU4095 cIND0983275)
Thanks!
Bob

wfcreate GPCM_Dem_Loader m 1950 2050
pagecreate(page=meta_data) u 1 1000
import(t=excel) C:\warem32\demand_loader_db.xlsx range="sector_cust_loc" @freq u 1
string locids = ""
string custcode = ""
!y = @obs(cust_loc_id01)
for !z = 1 to !y
%sample = @str(!z)
smpl %sample %sample
!val = @elem(cust_loc_id01,%sample)
%val = @str(!val)
string locids = locids + %val +" "
%val = @elem(cust_code,%sample)
string custcode = custcode + %val +" "
next

string CUSTIDS = @winterleave(custcode,locids)
Attachments
demand_loader_db.xlsx
(424.32 KiB) Downloaded 28 times
gpcm_dem_loader.wf1
(161.82 KiB) Downloaded 30 times

BT454
Posts: 44
Joined: Wed Aug 02, 2017 6:07 am

Re: removing spaces from string created using @winterleave

Postby BT454 » Fri Apr 05, 2019 11:27 am

I managed to figure this out by creating the string custids before the loop, and adding the values of each component string to it during the loop, with a space after the second component.
Thanks!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 12 guests