BookmarkSubscribeRSS Feed
npr
Fluorite | Level 6 npr
Fluorite | Level 6

I have a variable 

Y = I1 + b1E + b2M + b3V  , where

E =I2 + m2 * x1, where

x1 = I3 + m3 * x2 + m4 * x3  + m5 * x4

 

I want to find the value of x3 , x4 and x5 where the value of Y becomes 1 and Y becomes 0.

 

Is there a direct method in SAS to achevie this .. this is very similar to goal seek operation.

 

Any help would be appreciated

 

 

7 REPLIES 7
npr
Fluorite | Level 6 npr
Fluorite | Level 6

Hey Kurt

 

I was referring to two instances

 

1) where value of y is 0

2) where value of y is 1

Ksharp
Super User

Your equation has too many parameter.

Do you have some data for I1 I2 b1 b2 ......... like ?

I1   I2   b1   b2  ..

0.1  9    11   0.2

0.4  1     3    0.4

........

 

if you have , PROC NLIN could help you out.

And calling @Rick_SAS  who wrote a couple of blogs about this topic .

 

https://communities.sas.com/t5/Statistical-Procedures/PROCs-for-multiplicative-model/m-p/611435#M295...

Rick_SAS
SAS Super FREQ

We need more information.

  1. There is no x5 in your equations.
  2. I assume x2-x4 are the variables. Do all the other letters represent known constants, such as I1, I2, I3, b1, b2, b3, m2, m3, m4, and m5? What about M and V?

In general, this is a root-finding problem. You have one equation Y = L(x2, x3, x4)  where L is a linear function. For one equation and three unknowns, there are infinitely many solutions. Geometrically, the solution is a 2-D plane in (x2, x3, x4)-space.

 

If you clarify the problem and provide values for the constants, we can show you how to compute the solution in SAS.

npr
Fluorite | Level 6 npr
Fluorite | Level 6

1. There is no X5 variable

2. These are for various customers , so M and V are different for each customers.  I1, I2, I3, b1, b2, b3, m2, m3, m4, and m5 remain constant as these are coefficients from regression.

 

CustYEMV   
10.763640.42340.243250.1636 I10.1231
20.34510.4234210.56750.1674 I20.4564
30.847640.64560.47560.2457 I30.8675
40.468230.534660.523450.254564 b11
50.3457830.523450.67450.742 b21
60.7834780.35230.34520.876 b31
70.782460.545360.523450.2453 m20.1341
80.8276120.3520.74520.65434 m30.6456
90.894590.352340.667450.2341   
100.0948970.234520.2450.7547   
110.923420.23450.6470.24523   

 

I have pasted the above dummy data , it ll be helpful if u can show me what values of x2 ,x3 and x4 can give me values of y=0 and what values of x2,x3 and x4 can give me values of y=1 , for each customer .

Rick_SAS
SAS Super FREQ

You can solve this problem by hand by using algebraic manipulations. I did not double-check my calculations, so please read the comments for an explanation and to verify my algebra.  Also, you did not supply m4 or m5, but I indicated where you can plug those numbers in.

 

data Have;
retain I1	0.1231
       I2	0.4564
       I3	0.8675
       b1	1
       b2	1
       b3	1
       m2	0.1341
       m3	0.6456
       m4 1          /* OP did not supply */
       m5 1;         /* OP did not supply */
input Cust	Y	E	M	V;
datalines;
1	0.76364	0.4234	0.24325	0.1636	 	
2	0.3451	0.423421	0.5675	0.1674	 	
3	0.84764	0.6456	0.4756	0.2457	 	
4	0.46823	0.53466	0.52345	0.254564	 	
5	0.345783	0.52345	0.6745	0.742	 	
6	0.783478	0.3523	0.3452	0.876	 	
7	0.78246	0.54536	0.52345	0.2453	 	
8	0.827612	0.352	0.7452	0.65434	 	
9	0.89459	0.35234	0.66745	0.2341	 	 	 
10	0.094897	0.23452	0.245	0.7547	 	 	 
11	0.92342	0.2345	0.647	0.24523	 
;


proc iml;
/*
x1 = I3 + m3 * x2 + m4 * x3  + m5 * x4
E = I2 + m2 * x1
Y = I1 + b1*E + b2*M + b3*V 

so 
Y = I1 + b2*M + b3*V + b1*(I2 + m2 *(I3 + m3 * x2 + m4 * x3  + m5 * x4) )
  = I1 + b2*M + b3*V + b1*I2 + b1*m2*I3 + b1*m2*m3 *x2 + b1*m2*m4*x3 + b1*m2*m5*x4

Define 
c1 = I1 + b2*M + b3*V + b1*I2 + b1*m2*I3
c2 = b1*m2*m3
c3 = b1*m2*m4
c4 = b1*m2*m5

Then Y = c1 + c2*x2 + c3*x3 and c4*x4
or 
x2 = (Y - c1 - c3*x3 - c4*x4) / c2

Because the system is overdetermined, you can choose ANY VALUES for x3 and x4
For example, if you choose x3=1 and x4=1 then the two equations are
x2 = (0 - c1 - c3*x3 - c4*x4) / c2
and
x2 = (1 - c1 - c3*x3 - c4*x4) / c2
*/

data Want;
set Have;
c1 = I1 + b2*M + b3*V + b1*I2 + b1*m2*I3;
c2 = b1*m2*m3;
c3 = b1*m2*m4;
c4 = b1*m2*m5;

/* make a choice for x3 and x4 */
x3 = 1; x4 = 1;

do Ytarget = 0, 1;
   x2 = (YTarget - c1 - c3*x3 - c4*x4) / c2;
   output;
end;
run;

proc print data=Want;
   var cust yTarget x2 x3 x4;
run;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 983 views
  • 1 like
  • 4 in conversation