BookmarkSubscribeRSS Feed
desireatem
Pyrite | Level 9

The following runs without error but I do not know if the results id correct because I wish to perform the integral using "ni" as a by statement or class statement? I think my code might be treating the data set as a date with 12 observation. However it is a data set with 4 observation repeated  3 times.

Data sim;

Input ni A B;

cards;

1  1 3

1  2 7

1  3 10

1  4 12

2  1 3

2  2 9

2  3 10

2  3 10

3  1 3

3  2 9

3  3 10

3  3 10

;

Run;

proc iml;

use sim;

read all  var{ni A B} into DM;

close;

ni = DM[,1]; A = DM[,2]; B = DM[,3];

n = nrow(DM);

start Func(x);

   return(  exp(2-x)#cdf("Normal", x) );

finish;

answer = j(nrow(DM),1);

do i = 1 to nrow(DM);

call quad(result, "Func", A || B,);

answer = result;

end;

create kaplan1n var{ni A  B Answer };

append;

quit;

1 REPLY 1
desireatem
Pyrite | Level 9

I think there is no difference since the integration is performed independently for each row

sas-innovate-2024.png

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.

 

Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 1 reply
  • 759 views
  • 0 likes
  • 1 in conversation