On Mon, 4 Jan 2021, Sven Schreiber wrote:
Am 04.01.2021 um 09:47 schrieb Artur Bala:
>> Use the argname() function.
>>
>> Allin
>
> Yeah, that's quite clear but argname() generates a string not a
> series. And my point is different. Let's have the following:
> <\hans>
> function matrix myfunction (series depY, list X)
> # some coding
> ols depY X
> # some coding
> return something
> end function
> <hans>
>
> Now, when I run my function, let's say "mymatrix = myfunction(Price,
> xlist)", OLS printing will show up: "Dependent variable: depY"
instead
> of "Dependent variable: Price".
> Is there a way to have the actual name of depY displayed?
You could copy the input using argname, for example:
ID = genseries(argname(depY), depY)
Then you should be able to use the ID number also in the OLS command.
Of course the copying doesn't make it 100% efficient, but the loss
should be minor.
Or if you don't mind using string substitution, you could use
"rename":
<hansl>
function matrix myfunction (series depY, list X)
string realname = argname(depY)
rename depY @realname
ols @realname X
...
end function
</hansl>
Allin