Is there a way of fetching the variables that have been made exogenous when using the FLIPTYPE command?
It would be great if you could add a string function to retrieve that info. For now, I have been trying to make a program that retrieves this information from the msg-window after having used the FLIPTYPE command. However, the strings and information in this msg-window have been cut (with the last part being "..."), so that all information is not readily available here:
I have tried to make a program that uses the information in the msg-window to identify which variables have been made exogenous, but it is not perfect ... (see below)
Questions:
a) how can one use the msg-window to identify which variables have been made exogenous? (is there some way I can change the program below to accomplish this?)
b) could you please add a command that creates a string that holds the variables that have been made exogenous when using the FLIPTYPE command?
Thomas
Code: Select all
'store fliptypemessage
freeze({%maux}_info) {%maux}.msg
'find variables that are made exogenous, have to loop across the entire fliptype msg window
!lines={%maux}_info.@linecount
!iterline=0
for !i = 1 to !lines
%wordtotal=""
%wordtotals =""
%exogline= {%maux}_info.@line(!i)
!test= @instr(%exogline, "Equation ")
if !test>0 then
if %exogline<>"Equation Details" then
!iterline=!iterline+1
'must change the %exogline string since the equation is cut in EViews. But all we need is the info before the equality sign. As long as the equality sign is early in the equation, this approach should be fine (but it would be better if EViews could just provide us with this info)
%exogline= @mid( %exogline, 9) '@wnotin(@upper(%exogline), @upper("Equation ")) 'left with only equation
!testequality= @instr(%exogline, "=")-1
if !testequality>0 then
%exogline =@left(%exogline, !testequality)
else
'if the equality sign was not present in the string, we try to use the first couple of words
!lentest=0
!iterw=0
while !lentest<70
!iterw=!iterw+1
%word=@word(%exogline,!iterw)
%wordtotals=%wordtotal
%wordtotal=%wordtotal+" " + %word
!lentest=@len(%wordtotal)
'do not need to continue if first operator is division
if @trim(%word)="/" then
%wordtotal=%wordtotals 'do not add last word
!lentest=1000
endif
'do not need to continue loop if we have 8 words of the equations
if !iterw=8 then
!lentest=1000
'do not add the last word if it is an operator
if @trim(%word)="+" or @trim(%word)="-" or @trim(%word)="*" or @trim(%word)="/" then
%wordtotal=%wordtotals 'do not add last word
endif
endif
wend
%exogline = %wordtotal
endif
'add equality sign and zero to make the equation complete
%exogline = %exogline + "=0"
'find the left hand side variable of the equation that has been changed
%modellineaux=@getnextname("zaux")
model {%modellineaux}
{%modellineaux}.append {%exogline}
%exogvarmodellineaux={%modellineaux}.@endoglist
delete {%modellineaux}
'make list of dropped exogenous variables
%droppedexog= %droppedexog + " " + %exogvarmodellineaux
endif
endif
next
%droppedexog=@wsort(%droppedexog)