BookmarkSubscribeRSS Feed
Choose Language Hide Translation Bar
MathStatChem

Community Trekker

Joined:

Sep 11, 2013

How can I use recode to prepend a character string to each value?

The situation is that I have a column of sequential values "A", "B", "C", ...  and I want to transform them to "Label A", "Label B", "Label C", ...

3-1-2019 2-12-35 PM.jpg

I know how to do this with a column formula or with JSL, but I was wondering if this is possible with Recode?  Perhaps with using a regular expression?  Any ideas on how to do this with Recode?

 

1 ACCEPTED SOLUTION

Accepted Solutions
olippincott

Staff

Joined:

Jul 7, 2014

Solution

Re: How can I use recode to prepend a character string to each value?

There is an option in recode under the red triangle menu called "Replace String...". Check the box for regular expression. The regular expression for the position before the first charcter in a string is the ^ (caret). Place ^ in the search text box. Type Label into the replacement text box with a space after the word Label. Click okay and apply the recode. Replace String.PNG

 

-Olivia

3 REPLIES 3
markbailey

Staff

Joined:

Jun 23, 2011

Re: How can I use recode to prepend a character string to each value?

The Recode command works with the values in a column, not across column headers.

Learn it once, use it forever!
olippincott

Staff

Joined:

Jul 7, 2014

Solution

Re: How can I use recode to prepend a character string to each value?

There is an option in recode under the red triangle menu called "Replace String...". Check the box for regular expression. The regular expression for the position before the first charcter in a string is the ^ (caret). Place ^ in the search text box. Type Label into the replacement text box with a space after the word Label. Click okay and apply the recode. Replace String.PNG

 

-Olivia

Highlighted
MathStatChem

Community Trekker

Joined:

Sep 11, 2013

Re: How can I use recode to prepend a character string to each value?

Thanks! That's the answer I was looking for.