Replacement strings

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

fi99ggb
Posts: 26
Joined: Tue Jul 02, 2019 4:05 am

Replacement strings

Postby fi99ggb » Thu Aug 01, 2019 5:18 am

I am trying to do the following but it does not work. What is best way to do it?

%SKU = "1111"
%Spec = "X1_{%SKU} X2_{%SKU}"
equation eq
eq.ls log(Y_1111) c {%Spec}

This works but it is not helpful
%Spec = "X1_1111 X2_1111"
equation eq
eq.ls log(Y_1111) c {%Spec}

Thanks
George

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Replacement strings

Postby EViews Gareth » Thu Aug 01, 2019 8:26 am

Easiest way is probably:

Code: Select all

%spec = "X1_" + %sku + " X2_" + %sku

fi99ggb
Posts: 26
Joined: Tue Jul 02, 2019 4:05 am

Re: Replacement strings

Postby fi99ggb » Thu Aug 01, 2019 9:18 am

Thanks Gareth. I always appreciate the support.

I guess if my variable is X_1111_Total (instead of X_1111) I will need to define a string (like "X_" + %SKU + "_Total") and then pass it to %Spec. Just wanted to make sure that there is not another cleaner way.

Thanks
George


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests