UPDATE: Heres my code
data test;
input v1 v2 v3 v4 v5;
datalines;
0.0230 1.4334 1.46 0.01 0.26
;
run;
proc model data=test;
eq.sqrt = EXP(-v4*v5)*(v2*CDF('NORMAL',(LOG(v2/v3)+v5*(x**2)/2)/(x*SQRT(v5)),0,1)-v3*CDF('NORMAL',((LOG(v2/v3)-v5*(x**2)/2)/(x*SQRT(v5))),0,1))-v1;
solve x / out=test2;
run;
but it cannot find 'x', which should be simple to find, well in Matlab the fsolve function easily finds it, but in matlab i supply an initial value but here i have not, inital value should be say x=0.3, from memory matlab gave me an answer of 0.118 or something like that;.
my_data has 5 variables with 200 observations.
the variables, all numeric values are v1, v2, v3, v4 and v5
I have a nonlinear function of these variables F(x)=0
F(x) = EXP(-v4*v5)*(v2*CDF('NORMAL',((LOG(v2/v3)+v5*x^2/2)/(x*SQRT(v5))),0,1)-v3*CDF('NORMAL'((LOG(v2/v3)-v5*x^2/2)/(x*SQRT(v5))),0,1))-v1
I want to solve for x, i.e what 'x' value makes the above equation equal zero.
so for each record I want to use the values of 5 variables, put them into the above equation, solve it and return the value of 'x' into the record on the dataset, so i end up with a dataset with 6 variables.
Ive tried searching online but I find it so difficult looking, even with google!!
You effectively have to give it a starting value in the input dataset, as in :
data test;
input v1 v2 v3 v4 v5 x;
datalines;
0.0230 1.4334 1.46 0.01 0.26 0.1
;
run;
proc model data=test;
eq.first = EXP(-v4*v5)*(v2*CDF('NORMAL',(LOG(v2/v3)+v5*(x**2)/2)/(x*SQRT(v5)),0,1)-v3*CDF('NORMAL',((LOG(v2/v3)-v5*(x**2)/2)/(x*SQRT(v5))),0,1))-v1;
solve x / out=test2;
run;
PG
Have you looked into proc model? Take a look at: http://support.sas.com/documentation/cdl/en/etsug/60372/HTML/default/viewer.htm#etsug_model_sect006....
yes, I did look, it just looked overly complicated for such a simple procedure
i will have another look, if you think thats the place to findmy answer.
thank you
I managed to get some work done with proc model some time ago. Could you post 3 or 4 typical observations (v1-v5). I'll see if I can find my way back into it.
PG
You effectively have to give it a starting value in the input dataset, as in :
data test;
input v1 v2 v3 v4 v5 x;
datalines;
0.0230 1.4334 1.46 0.01 0.26 0.1
;
run;
proc model data=test;
eq.first = EXP(-v4*v5)*(v2*CDF('NORMAL',(LOG(v2/v3)+v5*(x**2)/2)/(x*SQRT(v5)),0,1)-v3*CDF('NORMAL',((LOG(v2/v3)-v5*(x**2)/2)/(x*SQRT(v5))),0,1))-v1;
solve x / out=test2;
run;
PG
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.