04-14-2016 08:49 AM
How to solve this problem:
%let bin371=MARINA, RV PARK, CAMPGROUND;
It is throwing me error "Positional parameters error" .I need to use qleft to remove trailing blanks. How can i Keep this value, and same time remove the trailing blanks.?
04-14-2016 09:19 AM
The auto macro %qleft only accepts up to two parameters. Look at what code your macro is creating:
%put %qleft(MARINA, RV PARK, CAMPGROUND);
You will see in the above there are three parameters as you have used commas in the string.
You could try:
%let bin371=MARINA, RV PARK, CAMPGROUND; %put %qleft(%quote(&bin371));
However, why bother with the above at all. Base SAS is designed to process and manipulate data. Macro SAS is designed to generate code. The two are for different purposes and trying to shoe horn data processing into macro language is not a good idea. Put your list in a dataset:
And then use that dataset, far easier to code and maintain.
04-14-2016 04:51 PM
%let bin371='MARINA, RV PARK, CAMPGROUND';
%let res= %qsysfunc(dequote(%left(&bin371)));
**MARINA, RV PARK, CAMPGROUND**
I find this useful, especially when you have '%', ';' , ',' and '&' in the text.
SAS often does automatic unquoting when you least expect it, so the single quotes let you decide when you want to unquote.