Calcite | Level 5

## question on count and format

Hi,

Quick question on count and format

select xx_yy,

count(1) format = comma12. as aci_knt

From wkly_wxxx_fnl

1 ACCEPTED SOLUTION

Accepted Solutions
Diamond | Level 26

## Re: question on count and format

@soujik wrote:

what does the comma12.

is it put comma after 12 digits?

As I said, it adds commas properly to your number. I have never seen a number with a comma after 12 digits. Since two people have given you a link to the documentation for the COMMA format, you can also look at the examples there.

--
Paige Miller
5 REPLIES 5
Diamond | Level 26

## Re: question on count and format

Count(1) counts the number of records in column 1 (which is the variable named xx_yy), which is also the same as the number of records in the data set; and format displays the result using the COMMA. format (in other words, with appropriate commas).

--
Paige Miller
Calcite | Level 5

## Re: question on count and format

what does the comma12.

is it put comma after 12 digits?

Super User

## Re: question on count and format

You can follow Maxim 4 and simply try it.

Diamond | Level 26

## Re: question on count and format

@soujik wrote:

what does the comma12.

is it put comma after 12 digits?

As I said, it adds commas properly to your number. I have never seen a number with a comma after 12 digits. Since two people have given you a link to the documentation for the COMMA format, you can also look at the examples there.

--
Paige Miller
Super User

## Re: question on count and format

COUNT() counts the number of times is argument is not missing.  So COUNT(1) is the same thing as COUNT(*), it just counts the number of observations.

FORMAT= is used to attach a format to the variable.  The COMMA format is used to display number with a comma as the thousands separator.  12 is the width of the format, how many bytes it prints.  So COMMA12 will show numbers in the style of ,234,678,012 .  So use 12 is a little silly for positive numbers.  Either use COMMA11. if you expect numbers smaller than 1 billion or use something wider than 12 if you expect counts over 1 billion.

Discussion stats
• 5 replies
• 232 views
• 1 like
• 4 in conversation