01-31-2017 11:26 PM
I have to write a SAS macro in terms of the Kolmogorov Smirnov statistic. I spent a lot of time to do it but haven't finished so who can help me please? The question is:
Write a SAS macro which has 3 parameters: m for the number of simulation iterations, n for the sample size, and @ for the upper tail probability. given values of the 3 parameters, it returns a simulation-based estimate of the (1-@) quantile of the sampling distribution of the Kolmogorov-Smirnov statistic for data from the standard normal distribution.
%D(m=500, n=5, @=0.10);
%D(m=1000, n=10, @=0.05);
02-01-2017 02:12 PM
I suggest you begin with
then write a DATA step that generates m samples, each of size n.
Run PROC UNIVARIATE with BY-group processing on the Sample ID variable.
Then analyze the empirical frequency of the indicator variable ( KS > alpha ).
For hints and similar Monte Carlo estimates, see
which uses PROC TTEST (on two independent samples) instead of the KS (on one sample).
After everything is debugged and working, it is trivial to wrap the code into a macro.