Drunken Daddy
Drunken Daddy

Reputation: 8001

SAS How to add space in between a string?

I want to generate value for a variable in this format X (XX). eg: 7 (70)

I've the values in the variables N and PctN_01. SO tried value = cats(N," (",PctN_01,")"); But its not adding the space. I get the result 7(70). So what do I do?

Upvotes: 0

Views: 14597

Answers (2)

jaymarvels
jaymarvels

Reputation: 434

If you're running a version of SAS prior to version 9 (catx not available) then you can do it along the lines of:

value = N || "(" || PctN_01 || ")";

Upvotes: 0

Chris J
Chris J

Reputation: 7769

You can use two 'cat' functions, cats and catx - catx concatenates with a delimiter...

value = catx(" ", N, cats("(", PctN_01, ")")) ;

Upvotes: 3

Related Questions