winrats inter-operation
Re: winrats inter-operation
Can you run the RATS program from the Windows command line directly?
Re: winrats inter-operation
Dear Tom:
It successful work only rats with rpf programe file from the Windows command line as follows:
It does not work with &fname as follows:
I have added envi path of ratsv10_64.exe.
MNZ_RESTAT_2003_PY.out is
Best regard
Hardmann
It successful work only rats with rpf programe file from the Windows command line as follows:
Code: Select all
ratsv10_64.exe C:\python_winrats\mnz_restat_2003.rpf /run
It does not work with &fname as follows:
Code: Select all
ratsv10_64.exe C:\python_winrats\mnz_restat_2003_py.rpf /fname='C:\python_winrats\LGDP.TXT' /run
I have added envi path of ratsv10_64.exe.
MNZ_RESTAT_2003_PY.out is
Code: Select all
open data &fname
<<<<
## SX22. Expected Type STRING, Got ANY Instead
Hardmann
Re: winrats inter-operation
That's not how the command line argument works. You need the /D switch:
/Dfname='C:\python_winrats\LGDP.TXT'
/Dfname='C:\python_winrats\LGDP.TXT'
Re: winrats inter-operation
Dear Tom:
It does not work. I simplified the problem and explained the situation again. I only use the lgdp.txt data file from MZN (2003). The new us_1gdp.rpf file, after reading the data, multiplies it by 100 and saves it as the us_1gdp.xls file, with nothing else. It works normally.
Now change the data file to &fname in us_LGDP_for_command.rpf. The folder is C:\Python-WinRats. The installation folder of winrats had been added to the system's environment variables.
us_Lgdp.rpf is
us_LGDP_for_command.rpf is
Run
or
in the command line of window. They do not work.
How can I do?
Best Regard
Hardmann
It does not work. I simplified the problem and explained the situation again. I only use the lgdp.txt data file from MZN (2003). The new us_1gdp.rpf file, after reading the data, multiplies it by 100 and saves it as the us_1gdp.xls file, with nothing else. It works normally.
Now change the data file to &fname in us_LGDP_for_command.rpf. The folder is C:\Python-WinRats. The installation folder of winrats had been added to the system's environment variables.
us_Lgdp.rpf is
Code: Select all
*
open data lgdp.txt
calendar(q) 1947
data(format=free,org=columns) 1947:01 1998:02 lgdp
*
set lgdp100 = 100.0*lgdp
open copy us_lgdp.xls
copy(dates,format=xls,org=columns) / lgdp100
Code: Select all
* Test for command line or python
*
open data &fname
calendar(q) 1947
data(format=free,org=columns) 1947:01 1998:02 lgdp
*
set lgdp100 = 100.0*lgdp
open copy us_lgdp.xls
copy(dates,format=xls,org=columns) / lgdp100
Code: Select all
ratsv10_64.exe C:\python_winrats\us_LGDP_for_command.rpf /fname='C:\python_winrats\LGDP.TXT' /run
Code: Select all
ratsv10_64.exe C:\python_winrats\us_lgdp_for_command.rpf /Dfname='C:\python_winrats\LGDP.TXT' /run
How can I do?
Best Regard
Hardmann
- Attachments
-
- lgdp.txt
- (3 KiB) Downloaded 291 times
-
- us_lgdp_for_command.rpf
- (236 Bytes) Downloaded 321 times
-
- us_lgdp.rpf
- (238 Bytes) Downloaded 288 times
Re: winrats inter-operation
Dear Tom:
Please help me.
Best Regard
Hardmann
Please help me.
Best Regard
Hardmann
Re: winrats inter-operation
Strip the '...' from the data file name argument:
ratsv10_64.exe C:\python_winrats\us_lgdp_for_command.rpf /Dfname=C:\python_winrats\LGDP.TXT /run
ratsv10_64.exe C:\python_winrats\us_lgdp_for_command.rpf /Dfname=C:\python_winrats\LGDP.TXT /run
Re: winrats inter-operation
Version 11 will now allow '....' in the value for the /Dnnnn=value command line option.
Re: winrats inter-operation
Dear Tom:
Thanks.I have updated my Winrats to version 11. I have tried the Dfname, it works. However, I try /Dfreq="quarter" /Dstart="1947Q1" to use FREQ and START inside the RATS program. It does not work.How do I set it up in Python and RPF?
I use python to call Winrats, and fname,startdate and enddate are inout parameter.
I take MZN as example.
my python code is:
mnz_restat_2003_py3.rpf
It response:
## SX22. Expected Type INTEGER, Got STRING Instead
>>>>&end lgdp
Please Tom help me.
Best regard
Hardmann
Thanks.I have updated my Winrats to version 11. I have tried the Dfname, it works. However, I try /Dfreq="quarter" /Dstart="1947Q1" to use FREQ and START inside the RATS program. It does not work.How do I set it up in Python and RPF?
I use python to call Winrats, and fname,startdate and enddate are inout parameter.
I take MZN as example.
my python code is:
Code: Select all
import subprocess
rats_path = "C:\Program Files (x86)\Estima\WinRATS Pro 11\\x64"
command = f'{rats_path}/ratsv11_64.exe C:\python_winrats\mnz_restat_2003_py3.rpf /Dfname="lgdp.xlsx" /Dstart="1947Q1" /Dend="1998Q2" /run '
Code: Select all
open data &fname
calendar(q) 1947:01
data(format=xlsx,org=columns) &start &end lgdp
## SX22. Expected Type INTEGER, Got STRING Instead
>>>>&end lgdp
Please Tom help me.
Best regard
Hardmann
Re: winrats inter-operation
Dear Hardmann,
in your rpf-file you use the DATA instrction, which expects start and end to be integer variable. But in the python program file, you pass start and end data as a string. Furthermore, for quarterly data you can write 1947:1 for the start and 1998:2 for the end. Thus, deleting in the python command the quotation marks and replacing the Q with the column sign, you should not get the error message anymore.
Best regards
PeterF
in your rpf-file you use the DATA instrction, which expects start and end to be integer variable. But in the python program file, you pass start and end data as a string. Furthermore, for quarterly data you can write 1947:1 for the start and 1998:2 for the end. Thus, deleting in the python command the quotation marks and replacing the Q with the column sign, you should not get the error message anymore.
Best regards
PeterF
Re: winrats inter-operation
The & is designed only for parameters where a literal string is expected. It doesn't work with general expressions. Instead, do separate definitions for (say) /DstartYear=1947 /DstartPer=1 and similarly for the end and use startYear:startPer for the start date.
Re: winrats inter-operation
Dear Tom:
Thanks. I got it.
Best Regard
Hardmann
Thanks. I got it.
Best Regard
Hardmann
Re: winrats inter-operation
That's not a bad idea. I will just have to see how hard it would be to make the & prefix resolve to an expression and not just a string.