• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 458
  • Last Modified:

SAS Character function - Question

Hi all,

I have a question:

str1 = ('2011-01-02, 2011-01-03, 2011-01-04');

I wanted to convert the string to as below:

str2 = ('2011-01-02' , '2011-01-03' , '2011-01-04');

Can any please help!!

Thanks in advance.
1 Solution

I'll test this on Monday when I have access to SAS again, but have you tried the TRANWRD function?

Str2 = TRANWRD(Str1, ","  , " ',' ");

This should replace all the commas with commas in single quotes. You need to copy the code above to see where I've used single and double quotes...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now