Osr when a varible is a unit root

Hi, I have just a question: am I wrong if I say that when a variable is no stationary I cannot use the command osr with that variable included in the loss fuction?
If it is so, How can I manage a situation like this? I created a dummy variable, the first difference, in order to detrend that variable and make it stationary. It seems to work, because I obtain the osr, but I still don’t know if it is a rigorous procedure.
Is there another way to detrend the variable and include it in the loss fuction. I was thinking to the command HP filter but if I understand well I can use it only at the end of a model and not inside the command osr.
thanks in advance for your help

Hi,

what you did is to include a log-linear variable in your objective. It can work but it can also not to make sense if the other variables are in levels… so a solution could be indeed to make the linearisation of the entire model. Do you know on which variable there is a a unit root? if its on prices you can stationnarize them by formulating the agregate and optimal prices in relative prices and inflation…)

Best