I am trying to save a table (with a date stamp) as a CSV file
The commands are
%date="c:\w1\jp_forecasts_"+@strnow("yyyy-mm-dd")
jp_table.save(t=csv) {%date}
These commands works in Version 12 but deliver the following error message in Version 13
Error message is :
Unable to open file c:\w1.csv in "JP_TABLE.SAVE(T=CSV)
C:\W1\JP_FORECASTS_2023-5-17" in FAN_JP.PRG on line 194.
Trouble saving Table to CSV file in Version 13
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Trouble saving Table to CSV file in Version 13
What is jp_table?
Follow us on Twitter @IHSEViews
Re: Trouble saving Table to CSV file in Version 13
Sorry.
jp_table is a TABLE object. Created using the commands:
group fcst num1 num2 num3
freeze(jp_table) fcst
'create string for file name path (with date stamp)
%date="c:\w1\jp_forecasts_"+@strnow("yyyy-mm-dd")
'saving Table to CSV file
jp_table.save(t=csv) {%date}
jp_table is a TABLE object. Created using the commands:
group fcst num1 num2 num3
freeze(jp_table) fcst
'create string for file name path (with date stamp)
%date="c:\w1\jp_forecasts_"+@strnow("yyyy-mm-dd")
'saving Table to CSV file
jp_table.save(t=csv) {%date}
Re: Trouble saving Table to CSV file in Version 13
Perhaps I should have put this in the 'bugs' category.
The problem seems to be when there is a <space> in the proposed file name.
In the following test program:
a file called TEST.csv is saved in the "0_work" directory when Version 13 is run
a file called FORECASTS_2023_5_18.csv is saved in the "0_work\test forecasts" directory when Version 12 is run (desired outcome)
(a file name with multiple <space> characters causes the program to crash in Version 13).
%runpath = @runpath
cd %runpath
wfcreate(wf=tble_test, page=trial) u 1 10
series num1 = rnd
series num2 = rnd
series num3 = rnd
group fcst num1 num2 num3
freeze(jp_table) fcst
%date="c:\0_work\test forecast\forecasts_"+@strnow("yyyy-mm-dd")
jp_table.save(t=csv) {%date}
The problem seems to be when there is a <space> in the proposed file name.
In the following test program:
a file called TEST.csv is saved in the "0_work" directory when Version 13 is run
a file called FORECASTS_2023_5_18.csv is saved in the "0_work\test forecasts" directory when Version 12 is run (desired outcome)
(a file name with multiple <space> characters causes the program to crash in Version 13).
%runpath = @runpath
cd %runpath
wfcreate(wf=tble_test, page=trial) u 1 10
series num1 = rnd
series num2 = rnd
series num3 = rnd
group fcst num1 num2 num3
freeze(jp_table) fcst
%date="c:\0_work\test forecast\forecasts_"+@strnow("yyyy-mm-dd")
jp_table.save(t=csv) {%date}
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Trouble saving Table to CSV file in Version 13
What happens if you use:
Code: Select all
jp_table.save(t=csv) %date
Follow us on Twitter @IHSEViews
Re: Trouble saving Table to CSV file in Version 13
That solution works. Thank you.
Who is online
Users browsing this forum: Google [Bot] and 25 guests