> Dear all,
>
> I was wondering if anybody knows the answer to the
> following? I have a macro listing various different
> statistical distributions. If I wish to simulate
> values from a certain distribution, I change the name
> of the macro variable which refers to that
> distribution.
>
> eg %let distribution='Normal'
> ......
> if &distribution="Normal" then
> distribution=rand('Normal',0,1);
>
> I would like to be able to call output generated by
> the distribution by the corresponding distribution
> name. For the above example the output dataset name
> would be "Normal". I have tried writing a new macro
> variable eg %let outdata=&distribution but this
> doesn't appear to work. Any thoughts on how to
> resolve this would be much appreciated.
I think you main issue is defining the macro variable with the quotes.
Try: %let distribution=NORMAL;
data &distribution;
if upcase("&distribution")='NORMAL' then x=rand ('NORMAL',0,1);
run;
... View more