hello,
I tried to search the archives for a similar topic but did not find one - so apologies if this has already been answered.
I am trying to print out results of some calculations to a csv file.
I have created a table with 2 rows, and 36 columns. and after i populate the table with the relevant values i try to print them out to a csv file. the file gets printed with the correct output but the program crash's immediately.
It seems to me that printing to the file is causing the program to crash.
I do not know how to attach a debugger to the program so i sprinkled @uiprompt() functions to simulate breakpoints. :-)
I have two @uiprompts() -> the first one right after i actually print to the file and exit the subroutine, and the 2nd one is after i immediately return from the subroutine that prints to the file.
I hit the @uiprompt after i print to the file, but do not hit the @uiprompt after i return from the function.
Is there a known issue printing large tables (2,40) to csv files?
code snippet:-----------------------------
subroutine equation_1()
print_forecast(.... with all the variables as described below...)
@uiprompt("done calling print forecast") ---> this line does not get executed.
endsub
subroutine print_forecast(scalar no_of_observations, scalar outlier_present, scalar var_outlier, scalar se, scalar r2, scalar rbar2, scalar fstat, scalar fstat_prob, scalar dw, scalar var_c, scalar var_t, scalar var_m1, scalar var_m2, scalar var_m3, scalar var_m4, scalar var_m5 scalar var_m6 scalar var_m7 scalar var_m8, scalar var_m9, scalar var_m10, scalar var_m11, scalar var_y1, scalar actual_y)
output(v) "C:\Users\rajivk\desktop\monthly\results\StatResults"
fetch(d=tmp) a_file_name
fetch(d=tmp) monthtoforecast
fetch(d=tmp) i
fetch(d=tmp) equation
fetch(d=tmp) print_legend
%tmp_file_name = a_file_name
string is_dollars = "STR"
if (@rwfind(%tmp_file_name, dollars) ) then
is_dollars = "STR"
endif
if (@rwfind(%tmp_file_name, units) ) then
is_dollars = "STU"
endif
%product_line = productline(1)
%productfamily = productfamily(1)
%producttype = producttype(1)
%productsegment = productsegment(1)
%businessunit = businessunit(1)
scalar product_code = productcode(1)
%company = company(1)
%forecastclass = forecastclass(1)
%stlregion = stl_region(1)
table(2,36) forecast_table
forecast_table.setformat(@all) f.9
if equation = 1 then
%value = "Equation 1: y c t q1 q2 q3 y(-1) "
endif
if equation = 2 then
%value = "Equation 2: y c t q1 q2 q3 "
endif
if equation = 3 then
%value = "Equation 3 : y c t"
endif
if equation = 4 then
%value = " Equation 4 : y c t y(-1)"
endif
if equation = 5 then
%value = "Equation 5 : log(y) c t q1 q2 q3 log(y(-1))"
endif
if equation = 6 then
%value = "Equation 6 : y c t t^2 q1 q2 q3 y(-1)"
endif
if equation = 7 then
%value = "Equation 7 : y c t t^2 q1 q2 q3"
endif
if equation = 8 then
%value = "Equation 8 : y c t t^2 y(-1)"
endif
if equation = 9 then
%value = "Equation 9 : y c t t^2"
endif
if equation = 10 then
%value = "Equation 10 : log(y) c t q1 q2 q3"
endif
if equation = 11 then
%value = "Equation 11 : log(y) c t log(y(-1))"
endif
if equation = 12 then
%value = "Equation 12 : log(y) c t "
endif
if outlier_present = 1 then
%final_value = %value + " outlier"
else
%final_value = %value
endif
forecast_table(2,35) = %final_value
forecast_table(2,36) = monthtoforecast
forecast_table(2,1) = is_dollars
forecast_table(2,2) = %product_line
forecast_table(2,3) = %productfamily
forecast_table(2,4) = %producttype
forecast_table(2,5) = %productsegment
forecast_table(2,6) = %businessunit
forecast_table(2,7) = product_code
forecast_table(2,8) = %company
forecast_table(2,9) = %forecastclass
forecast_table(2,10) = %stlregion
forecast_table(2,11) = no_of_observations
forecast_table(2,12) = outlier_present
forecast_table(2,13) = var_outlier
forecast_table(2,14) = se
forecast_table(2,15) = r2
forecast_table(2,16) = rbar2
forecast_table(2,17) = fstat
forecast_table(2,18) = fstat_prob
forecast_table(2,19) = dw
forecast_table(2,20) = var_c
forecast_table(2,21) = var_t
forecast_table(2,22) = var_m1
forecast_table(2,23) = var_m2
forecast_table(2,24) = var_m3
forecast_table(2,25) = var_m4
forecast_table(2,26) = var_m5
forecast_table(2,27) = var_m6
forecast_table(2,28) = var_m7
forecast_table(2,29) = var_m8
forecast_table(2,30) = var_m9
forecast_table(2,31) = var_m10
forecast_table(2,32) = var_m11
forecast_table(2,33) = var_y1
forecast_table(2,34) = actual_y
print forecast_table
@uiprompt("done printing") --> i hit this uiprompt, and the program crash's immediately after this
endsub
Crash on printing table to csv format
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
startz
- Non-normality and collinearity are NOT problems!
- Posts: 3798
- Joined: Wed Sep 17, 2008 2:25 pm
Re: Crash on printing table to csv format
The EViews guys are going to want to know the version and build date of your copy.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Crash on printing table to csv format
The EViews guys are going to want to know the version and build date of your copy.
Re: Crash on printing table to csv format
I am using eviews7 for windows. i dont know the build date.
i spent some time and found the following issues that i fixed in the program:
1)If i pass more than 12 arguments to a subroutine, the program crash's - no message in the error log window
2)to circumvent that problem, i'm storing the extra variables in a DB and then fetch them within the subroutine. I found the following issue with storing and retrieving variables in the dbase, again no messages in the error log window.
subroutine sample_subroutine(scalar tmp_var)
store(d=tmp)tmp_var
call my_test_function (foo)
endsub
subroutine my_test_function(scalar foo)
fetch(d=tmp)tmp_var -> this crash's the program. basically i cannot store variables that have been passed into a subroutine and then retrieve them in another subroutine
bottom line, it was very painful to debug these issues without any debugging mode of the program.
thanks
rajiv
i spent some time and found the following issues that i fixed in the program:
1)If i pass more than 12 arguments to a subroutine, the program crash's - no message in the error log window
2)to circumvent that problem, i'm storing the extra variables in a DB and then fetch them within the subroutine. I found the following issue with storing and retrieving variables in the dbase, again no messages in the error log window.
subroutine sample_subroutine(scalar tmp_var)
store(d=tmp)tmp_var
call my_test_function (foo)
endsub
subroutine my_test_function(scalar foo)
fetch(d=tmp)tmp_var -> this crash's the program. basically i cannot store variables that have been passed into a subroutine and then retrieve them in another subroutine
bottom line, it was very painful to debug these issues without any debugging mode of the program.
thanks
rajiv
Who is online
Users browsing this forum: No registered users and 2 guests
