10-29-2015 11:56 PM
please look at my coding and correct my mistake.i want to generate 100 samples from a normal distribution with mean of 0 and standard deviation of 10 and construct two 95% confidence intevals for the mean under assumption of known variance and unknown variance seperately for each sample and mark thoes intervals that do not cover mean 0 ,by three stars***. i want to have 20 observations for this prosse.i want to use sas macro language.
here is my coding:
input mean n std upcl lowcl alpha=alpha t0 z0 tu tl zu zl;
%do j=1 to 20;
%do i=1 %to 100;
proc means data=&dat mean clm std n;
data two ;
set stat (drop =_TYPE_ _FREQ_);
%put &b is &eval_b;
%if &b>0 %then %put label &x='***';
%else %if &b<0 %then %put label &x='';
proc append base=x data=two;
call execute('proc print data=mymac;run;');
10-30-2015 05:58 AM
Before you proceed you might want to read a little bit about how to perform efficient simulation in SAS.
As a general rule, you should avoid using macro loops to "drive" the simulation of multiple samples.
See the article "Simulation in SAS: The slow way or the BY way."
If this is a classroom exercise and you are REQUIRED to use macro, then let us know. We can address your programming errors and give you hints without writing the program for you.
If this is not a classroom exercise, then this problem does not require any macro code. The link I've provided includes SAS code that generates multiple samples. The example uses the uniform distribution, but can be easily modified to use the normal distribution.