The SAS Output Delivery System and reporting techniques

Concatenating numeric variable with thousands separator format

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 10
Accepted Solution

Concatenating numeric variable with thousands separator format

Hi, 

 

I have a few numeric variables that I would like to concatenate and have the numeric variables with thousands separator format. How can I do this? An example of numeric variables (Mean & SD) and the format I want to report Mean (SD) is as below.

 

MeanSDMean (SD)
1110053250001,110,053 (25,000)
35505535035,505 (5,350)

Accepted Solutions
Solution
‎05-24-2017 01:54 AM
Super User
Posts: 17,905

Re: Concatenating numeric variable with thousands separator format

Use the CATT functions to combine the values. Use PUT to convert to desired format. 

 

X = CATT(put(mean, comma16.), ' (', put(sd, comma16.2), ')' );

PS search lexjansen.com for macro clinical reports or macro table 1

Youll find tons of examples. One good one is Creating complex reports by Cynthia Zender @Cynthia_sas

View solution in original post


All Replies
Solution
‎05-24-2017 01:54 AM
Super User
Posts: 17,905

Re: Concatenating numeric variable with thousands separator format

Use the CATT functions to combine the values. Use PUT to convert to desired format. 

 

X = CATT(put(mean, comma16.), ' (', put(sd, comma16.2), ')' );

PS search lexjansen.com for macro clinical reports or macro table 1

Youll find tons of examples. One good one is Creating complex reports by Cynthia Zender @Cynthia_sas

Occasional Contributor
Posts: 10

Re: Concatenating numeric variable with thousands separator format

Thanks! That solves it beautifully!
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 141 views
  • 0 likes
  • 2 in conversation