hi!
i have a word like this "At 63.6% , the labour-force participation rate is at its lowest level",
but I want to get the result like this "At 63.6%, the labour-force participation rate is at its lowest level",
What should I do?
Use the COMPBL function.
not work,have a error !
ERROR: The function COMPBL referenced by the %SYSFUNC or %QSYSFUNC macro function has too many arguments.
Will not be the "%" problem?
If your are doing this in a macro, you will need something like this:
%let want = %sysfunc(tranwrd(%qsysfunc(compbl(%quote(&have))), %str(% ,), %str(%,)));
Ah yes, then to get rid of the space between % and ,
tranwrd(compbl(string), " ,", ",")
It would be easier to correct the problem earlier in the process, rather than after the string has been created.
Your code has created a macro variable that contains leading and trailing blanks, such as 63.6%
Get rid of the leading and trailing blanks before plugging that into the longer string. One easy way:
%let macrovar = ¯ovar;
Then plug it in:
%let string = At ¯ovar, the labour-force participation rate is at its lowest level;
Good luck.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.
Ready to level-up your skills? Choose your own adventure.