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
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.