Hi SAS Experts,
I am creating a macro variable %LET RepQuarter = '4th (October-December)'; and insert it later on
in my custom ods xml tagset.
define event EmitMetaMainMessage;
xdent;
put "</Metas>" CR;
put "<main>" CR;
put "<year>&RepYear" ;
put "</year>" CR;
put "<quarter>&RepQuarter" ;
put "</quarter>" CR;
end;
But I need it without the quotes'. How can I remove those?
Bye
Agree with @RW9 about not adding the quotes in the first place. But if you want to remove them, you can use the DEQUOTE function.
1 %LET RepQuarter = '4th (October-December)'; 2 3 data _null_; 4 put "<quarter>&RepQuarter" ; 5 put "<quarter>%sysfunc(dequote(&RepQuarter))" ; 6 run; <quarter>'4th (October-December)' <quarter>4th (October-December)
Hi,
Why have you put quotes on it in the first place?
%LET RepQuarter = 4th (October-December);
Problem solved. The next question is, why is data in a macro parameter?
Yes, but then you haven't thought about the data, and the process then have you. If you need parameters, put them into a dataset, its is far easier to work with. Datasets are there to work with Data, macro variables are there as find and replace, and as you are seeing in your example, that find and replace fails as you are using it in multiple ways.
Agree with @RW9 about not adding the quotes in the first place. But if you want to remove them, you can use the DEQUOTE function.
1 %LET RepQuarter = '4th (October-December)'; 2 3 data _null_; 4 put "<quarter>&RepQuarter" ; 5 put "<quarter>%sysfunc(dequote(&RepQuarter))" ; 6 run; <quarter>'4th (October-December)' <quarter>4th (October-December)
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.