DATA Step, Macro, Functions and more

concatinating macro variable

Accepted Solution Solved
Reply
New Contributor
Posts: 4
Accepted Solution

concatinating macro variable

i have two macro vatiable as below
%let path='c:/users/sourabh/'
%let file='online.csv'
i need
'c:/users/sourabh/online.csv'
kindly suggest how can i achieve dat

Accepted Solutions
Solution
3 weeks ago
Super User
Posts: 10,761

Re: concatinating macro variable

%let path='c:/users/sourabh/' ;
%let file='online.csv' ;

%let want=%str(%')%sysfunc(dequote(&path))%sysfunc(dequote(&file))%str(%');

%put &want ;

View solution in original post


All Replies
Super User
Posts: 10,209

Re: concatinating macro variable

Start by not putting quotes into macro variables, and it is very easy:

%let path=c:/users/sourabh/;
%let file=online.csv;

%let want=&path.&file.;

Only use (double) quotes where you use the macro variable, eg in a filename statement.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Solution
3 weeks ago
Super User
Posts: 10,761

Re: concatinating macro variable

%let path='c:/users/sourabh/' ;
%let file='online.csv' ;

%let want=%str(%')%sysfunc(dequote(&path))%sysfunc(dequote(&file))%str(%');

%put &want ;
☑ This topic is solved.

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

Discussion stats
  • 2 replies
  • 82 views
  • 2 likes
  • 3 in conversation