f



Re: &&&&&& #8

On Thu, 9 Jun 2005 13:38:44 -0400, Talbot Michael Katz <topkatz@MSN.COM> wrote:

>Hi.
>
>It requires SIX ampersands to resolve the macro variable example below:
>
>data _null_ ;
> set DS1 end = last ;
> call symput("mlv" || compress(put(_N_,best32.)), mli)
> ;
> call symput(mli, tdt) ;
> if last then do ;
>  call symput("mlin", compress(put(_N_,best32.))) ;
> end ;
>run ;
>%put &&mlv&mlin.  = &&&&&&mlv&mlin. ;
>
>(So, if there are five observations in the data set, and the fifth value of
>mli is "DAISY" and the fifth value of tdt is "YELLOW" this will print
>out "DAISY = YELLOW")
>
>Why does it take so many ampersands to resolve?  Can someone please explain
>this resolution to me so that it gets through my extremely dense skull?

Hi, TMK,

If you are allowed to use up one more (global) macro variable, then you
don't have to use the six ampersands. It is my hunch that you can always
re-write them so that they involve only three or less ampersands.

Cheers,
Chang

data ds1;
  mli = "DAISY";
  tdt = "YELLOW";
run;

data _null_;
 set ds1 end = last;
 call symput("mlv" || compress(put(_N_,best32.)), mli);
 call symput(mli, tdt);
 if last then do;
  call symput("mlin", compress(put(_N_,best32.)));
 end;
run;
%let m = &&mlv&mlin..;
%put &m  = &&&m..;
/* on log
DAISY  = YELLOW
*/
0
chang_y_chung (1975)
6/9/2005 6:31:27 PM
comp.soft-sys.sas 142828 articles. 1 followers. Post Follow

0 Replies
734 Views

Similar Articles

[PageSpeed] 36

Reply: