|Date: ||Wed, 22 Feb 2012 14:46:13 -0600|
|Reply-To: ||Joe Matise <snoopy369@GMAIL.COM>|
|Sender: ||"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>|
|From: ||Joe Matise <snoopy369@GMAIL.COM>|
|Subject: ||Re: Anybody got a %commify macro?|
|Content-Type: ||text/plain; charset=ISO-8859-1|
%sysfunc(tranwrd(&your_macro_var,%str( ),%str(, )));
%let my_var=%commify(bibbity bobbity boo) ;
Assuming you can rely on having one space between words and no extra spaces.
On Wed, Feb 22, 2012 at 2:40 PM, Pardee, Roy <email@example.com> wrote:
> I need a macro that will insert commas between the words of a string.
> Before I set about writing that, I thought I'd ask if anybody on this list
> has one already they're willing to share? Googling has not availed me.
> I want to be able to say, e.g.,
> %let my_var = %commify(bibbity bobbity boo) ;
> And have &my_var = bibbity, bobbity, boo.
> Input will be individual variable names, if that helps.
> Anybody got something like that handy?
> Roy Pardee | DATA WRANGLER
> Group Health Research Institute
> PHONE 360-447-8773 | 206-287-2078
> E-MAIL firstname.lastname@example.org
> GHC Confidentiality Statement
> This message and any attached files might contain confidential information
> protected by federal and state law. The information is intended only for
> the use of the individual(s) or entities originally named as addressees.
> The improper disclosure of such information may be subject to civil or
> criminal penalties. If this message reached you in error, please contact
> the sender and destroy this message. Disclosing, copying, forwarding, or
> distributing the information by unauthorized individuals or entities is
> strictly prohibited by law.