inserting text files in string

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

F_Laroche
Posts: 9
Joined: Mon Jan 21, 2019 2:52 pm

inserting text files in string

Postby F_Laroche » Tue Jan 22, 2019 7:24 am

Hi,

I used a code to save some string lists as text files, and now I'm trying to convert those text files as new string lists in another code. The only way I found is to create a blank string list and manually use the option "insert text file" as seen on the capture I also posted. When I check on the capture window, it doesn't seem to have registered a command. is such command exist?

thanks in advance
Attachments
Capture.PNG
Capture.PNG (17.5 KiB) Viewed 5905 times

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

Re: inserting text files in string

Postby EViews Gareth » Tue Jan 22, 2019 8:45 am

You'd have to go through a text object. text.append to open the text file.
Follow us on Twitter @IHSEViews

F_Laroche
Posts: 9
Joined: Mon Jan 21, 2019 2:52 pm

Re: inserting text files in string

Postby F_Laroche » Tue Jan 22, 2019 8:58 am

This create a new text object, but I need to convert those to string lists. Is it possible?

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

Re: inserting text files in string

Postby EViews Gareth » Tue Jan 22, 2019 9:08 am

What's a string list?
Follow us on Twitter @IHSEViews

F_Laroche
Posts: 9
Joined: Mon Jan 21, 2019 2:52 pm

Re: inserting text files in string

Postby F_Laroche » Tue Jan 22, 2019 9:12 am

It's just a string object. Sorry about that.

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

Re: inserting text files in string

Postby EViews Gareth » Tue Jan 22, 2019 9:28 am

There isn't an easy way to do it. String objects aren't really intended for that sort of thing (I'm kinda surprised the menu item exists!).

If the text file only has one line, you would go through a text object, then grab the first line into a string. Or convert the text object into an svector and loop through or something.
Follow us on Twitter @IHSEViews

F_Laroche
Posts: 9
Joined: Mon Jan 21, 2019 2:52 pm

Re: inserting text files in string

Postby F_Laroche » Tue Jan 22, 2019 9:31 am

Ok I understand. Since I saved those files from string objects that I created, is there a better way to save them for other use than saving them as text?

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

Re: inserting text files in string

Postby EViews Gareth » Tue Jan 22, 2019 9:39 am

No.

Given that there isn't a proc to save strings as text, how did you save them?
Follow us on Twitter @IHSEViews

F_Laroche
Posts: 9
Joined: Mon Jan 21, 2019 2:52 pm

Re: inserting text files in string

Postby F_Laroche » Tue Jan 22, 2019 10:53 am

I used this code:
%BD = "EMERGE G10 EMERGECW EMERGELA EMERGEMA EMERGEPR"
for %B {%BD}
%path = "\\lacaisse.com\gdd\ACD\PR\HAVER\DATA\"+%B+".dat"
string list_{%B} = @wquery(%PATH, "name matches *", "name")
string list_{%B}_M = @wquery(%path, "freq=m", "name")
string list_{%B}_Q = @wquery(%path, "freq=q", "name")
string list_{%B}_A = @wquery(%path, "freq=a", "name")
FREEZE(flist_{%B}) list_{%B}
FREEZE(flist_{%B}_M) list_{%B}_M
FREEZE(flist_{%B}_Q) list_{%B}_Q
FREEZE(flist_{%B}_A) list_{%B}_A

%page = "M Q A"
%save = "h:\ra\gestion dynamique des devises\données\analyse comparative\emerging\donnees\tables\"+ %B + ".txt"
FLIST_{%B}.save {%SAVE}

for %p {%page}
%save_p = "h:\ra\gestion dynamique des devises\données\analyse comparative\emerging\donnees\tables\"+ %B + "_"+ %p +".txt"
flist_{%B}_{%P}.save {%save_p}
next
next

FREEZE(flist_{%B}_A) list_{%B}_A
FLIST_{%B}.save {%SAVE}



But I actually found a way to get around the problem, I juste saved the wf and opened it in my other program.

Thank you for your help.


Return to “Data Manipulation”

Who is online

Users browsing this forum: Baidu [Spider] and 19 guests