DATA Step, Macro, Functions and more

Using macro variable in %Let

Accepted Solution Solved
Reply
Frequent Contributor
Frequent Contributor
Posts: 134
Accepted Solution

Using macro variable in %Let

Why doesn't this work ? It assigns the path with &diag as the string value and not the value of &diag. Is there a work-around ?

 

%Let diag=ovarian ;
%Let path=Z:\Analysis\&diag ;

 


Accepted Solutions
Solution
‎11-01-2016 04:04 PM
Frequent Contributor
Posts: 141

Re: Using macro variable in %Let

%Let diag=ovarian ;

%Let path=%str(Z:\Analysis\&diag) ;

 

FYI

http://www2.sas.com/proceedings/forum2007/152-2007.pdf

Thanks,
Suryakiran

View solution in original post


All Replies
Solution
‎11-01-2016 04:04 PM
Frequent Contributor
Posts: 141

Re: Using macro variable in %Let

%Let diag=ovarian ;

%Let path=%str(Z:\Analysis\&diag) ;

 

FYI

http://www2.sas.com/proceedings/forum2007/152-2007.pdf

Thanks,
Suryakiran
Super User
Posts: 3,261

Re: Using macro variable in %Let

Works fine for me:

 

23 %Let diag=ovarian ;
24 %Let path=Z:\Analysis\&diag ;
25
26 %put &path;
Z:\Analysis\ovarian

 

Please post your log.

Super Contributor
Posts: 394

Re: Using macro variable in %Let

Works for me:

 

macro.jpg

Frequent Contributor
Posts: 141

Re: Using macro variable in %Let

Make sure you run %Let diag=ovarian ;

If you run only %Let path=Z:\Analysis\&diag ;
it will not resolve the macro variable.
Thanks,
Suryakiran
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 333 views
  • 0 likes
  • 4 in conversation