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.
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.