Difference between revisions of "NumberFormat"

Line 1: Line 1:
 
[[Category:Attributes]]
 
[[Category:Attributes]]
  
= NumberFormat Attribute =
+
== NumberFormat attribute ==
  
 
This attribute records the Number Format settings for a variable.
 
This attribute records the Number Format settings for a variable.
Line 8: Line 8:
  
 
== Format ==
 
== Format ==
 +
The [[NumberFormat]] attribute has the following format:
 +
: 2, formatcode, proxy, zeroes, separators, currency, digits, trailingZeros, currencysymbol,  currencyPlacement, datetemplate, ''fullPrecision''
  
The number format has the following format:
+
where:
  
    2, formatcode, proxy, zeroes, separators, currency,
+
First field is the version number of the number format
      digits, trailingZeros, currencysymbol, currencyPlacement,
+
;<code>«formatcode»</code>: is one of:
      datetemplate, fullPrecision
+
::<code>D</code>: Suffix
&nbsp;
+
::<code>E</code>: Exponential
where:
+
::<code>F</code>: Fixed point
    - First field is version #
+
::<code>I</code>: Integer
    - Format code: is same as in version 1.
+
::<code>%</code>: Percent
    - Proxy : When format code is a date, this is  
+
::<code>DD</code>: Date
        set to 0, 1, or 2 based on datetype.  For a
+
::<code>DB</code>: Boolean
        non-date, same as digits.  This is not used
+
;<code>«'''proxy'''»</code> : When format code is a date, this is set to <code>0</code>, <code>1</code>, or <code>2</code> based on datetype.  For a non-date, same as digits.  This is not used directly, but is set like this to be upward compatible with Analytica 3.1 and before.
        directly, but is set like this to be upward
+
;<code>«zeroes»</code>: Number of digits after the decimal in fixed point and percent formats.
        compatible with version 3.1 and before.
+
;<code>«separators»</code>: <code>0</code> or <code>1</code>, whether commas are used
    - zeroes: same as in version 1
+
;<code>«currency»</code>: <code>0</code> or <code>1</code>, whether currency symbol is shown
    - separators: 0 or 1, same as in version 1
+
;<code>«trailingZeros»</code>: boolean.  <code>True</code> = add trailing zeros to fill out precision
    - currency: 0 or 1, same as in version 1
+
;<code>«digits»</code>: Number of digits for exponent and suffix types.
    - trailingZeros: boolean.  True=add trailing zeros to fill out precision
+
;<code>«currencySymbol»</code>: Multi-character symbol used for currency. Blank will use regional currency symbol.
    - digits: # digits for exponent and suffix types.
+
;<code>«currencyPlacement»</code>: One of these values:
    - currencySymbol: Multi-character symbol used for  
+
::<code>0</code> = $-x
          currency. Blank will use regional currency
+
::<code>1</code> = -$x
          symbol.
+
::<code>2</code> = -x$
    - currencyPlacement: One of these values:
+
::<code>3</code> = $x-
          0 = $-x
+
::<code>4</code> = x$-
          1 = -$x
+
::<code>5</code> = x-$
          2 = -x$
+
::<code>6</code> = ($x)
          3 = $x-
+
::<code>7</code> = (x$)
          4 = x$-
+
::<code>8</code> = use regional setting
          5 = x-$
+
;<code>«datetemplate»</code>:  A string composed of these fields
          6 = ($x)
+
::<code>y</code> = Two digit year with no leading zero, e.g., 5
          7 = (x$)
+
::<code>yy</code> = Two digit year, e.g., 05
          8 = use regional setting
+
::<code>yyyy</code> = Four digit year, e.g., 2005  
    - date template:  A string composed of these fields:
+
::<code>M</code> = Numeric month (no leading zero), e.g., 4
        Using
+
::<code>MM</code> = Numeric month w/leading zero, e.g., 04
        y = Two digit year with no leading zero, e.g., 5
+
::<code>MMM</code> = Abbreviated month, e.g., Apr
        yy = Two digit year, e.g., 05
+
::<code>MMMM</code> = Full month name, e.g., April
        yyyy = Four digit year, e.g., 2005  
+
::<code>d</code> = day of month, e.g., 9
        M = Numeric month (no leading zero), e.g., 4
+
::<code>dd</code> = day of month w/leading zero, e.g., 09
        MM = Numeric month w/leading zero, e.g., 04
+
::<code>ddd</code> = abbreviated ordinal day of month, English only, e.g., 9th
        MMM = Abbreviated month, e.g., Apr
+
::<code>dddd</code> = Ordinal day of month, English only, e.g., ninth
        MMMM = Full month name, e.g., April
+
::<code>Dddd</code> = Ordinal day of month, capitalized, e.g., Ninth
        d = day of month, e.g., 9
+
::<code>www</code> = Abbreviated weekday name
        dd = day of month w/leading zero, e.g., 09
+
::<code>wwww</code> = Weekday name, e.g., Saturday
        ddd = abbreviated ordinal day of month, English only, e.g., 9th
+
::<code>q</code> = quarter, 1 through 4, e.g., 2
        dddd= Ordinal day of month, English only, e.g., ninth
+
::<code>LONG</code> : regional long date format, e.g., Saturday, April 9, 2005
        Dddd= Ordinal day of month, capitalized, e.g., Ninth
+
::<code>SHORT</code>: regional short date format, e.g., 4/09/05
        www = Abbreviated weekday name
+
::<code>ABBREV</code> : abbreviated version of long date format, e.g., Tue, Apr 9, 2005
        wwww = Weekday name, e.g., Saturday
+
::<code>SABBREV</code> : abbreviated version of long date format w/o weekday, e.g., Apr 9, 2005
        q = quarter, 1 through 4, e.g., 2
+
::<code>SLONG</code> : regional long date with weekday stripped, e.g., April 9, 2005
        LONG : regional long date format, e.g., Saturday, April 9, 2005
+
:::&rsquo;&rsquo;&rsquo;&rsquo; : A single quote, e.g., "MMM &rsquo;&rsquo;&rsquo;&rsquo;yy" would be to produce "Apr '05"
        SHORT: regional short date format, e.g., 4/09/05
+
:::The doubled ' inside escapes the '.  
        ABBREV : abbreviated version of long date format, e.g., Tue, Apr 9, 2005
+
:: Literal characters: /, -, [dot], [space], [comma]
        SABBREV : abbreviated version of long date format w/o weekday, e.g., Apr 9, 2005
+
::: 'text' : literal text, e.g., 'Q'q could produce Q2
        SLONG : regional long date with weekday stripped, e.g., April 9, 2005
+
;<code>«fullPrecision»</code>: (optional), <code>0</code> or <code>1</code> (default <code>0</code>) : whether full precision is required always
                  &rsquo;&rsquo;&rsquo;&rsquo; : A single quote, e.g., "MMM &rsquo;&rsquo;&rsquo;&rsquo;yy" would be to produce "Apr \'05"
 
                  The doubled ' inside escapes the '.  
 
        Literal characters: /, -, [dot], [space], [comma]
 
                  'text' : literal text, e.g., 'Q'q could produce Q2
 
    - fullPrecision (opt): 0 or 1 (default 0) : whether full precision is req always
 
  
= Analytica 3.1 =
+
== History ==
 +
In Analytica 1.0 through 3.1, the [[NumberFormat]] was:
  
In Analytica 1.0 through 3.1, the format was:
+
: 1, formatcode, digits, zeroes, separators, currency
 +
where:
  
    1, formatcode, digits, zeroes, separators, currency
+
First field is version number
&nbsp;
+
;<code>«formatcode»</code> :is one of:
Where:
+
::<code>D</code>: Suffix
    - First field is version #
+
::<code>E</code>: Exponential
    - format code is one of:
+
::<code>F</code>: Fixed point
        D : Suffix
+
::<code>I</code>: Integer
        E : Exponential
+
::<code>%</code>: Percent
        F : Fixed point
+
::<code>DD</code>: Date
        I : Integer
+
::<code>DB</code>: Boolean
        % : Percent
+
;<code>«digits»</code>: Specified number of digits for exponent and suffix types, or the date type as follows:
        DD: Date
+
::<code>0</code> = Short
        DB: Boolean
+
::<code>1</code> = Long
    - digits: Specifies # of digits for exponent and suffix  
+
::<code>2</code> = Abbrev
              types, or the date type as follows:
+
;<code>«zeroes»</code>: Number of digits after the decimal in fixed point and percent formats.
          0 = Short
+
;<code>«separators»</code>: <code>0</code> or <code>1</code>, whether commas are used
          1 = Long
+
;<code>«currency»</code>: <code>0</code> or <code>1</code>, whether currency symbol is shown
          2 = Abbrev
+
 
    - zeroes: # of digits after the decimal in fixed point
+
==See Also==
        and percent formats.
+
* [[Number format]]
    - separators: 0 or 1, whether commas are used
+
* [[NumberToText]]
    - currency: 0 or 1, whether currency symbol is shown
+
* [[ParseNumber]]

Revision as of 21:28, 26 January 2016


NumberFormat attribute

This attribute records the Number Format settings for a variable.

In Analytica, only one number format is associated with any one object. To use multiple different number formats in a single table, you must have multiple objects (variables) storing each of the number formats. If you have a self-index consisting of identifiers (or define your result as a list of identifiers), the number format for each column will be taken from the variable who identifier heads that self-index column.

Format

The NumberFormat attribute has the following format:

2, formatcode, proxy, zeroes, separators, currency, digits, trailingZeros, currencysymbol, currencyPlacement, datetemplate, fullPrecision

where:

First field is the version number of the number format

«formatcode»
is one of:
D: Suffix
E: Exponential
F: Fixed point
I: Integer
%: Percent
DD: Date
DB: Boolean
«proxy»
When format code is a date, this is set to 0, 1, or 2 based on datetype. For a non-date, same as digits. This is not used directly, but is set like this to be upward compatible with Analytica 3.1 and before.
«zeroes»
Number of digits after the decimal in fixed point and percent formats.
«separators»
0 or 1, whether commas are used
«currency»
0 or 1, whether currency symbol is shown
«trailingZeros»
boolean. True = add trailing zeros to fill out precision
«digits»
Number of digits for exponent and suffix types.
«currencySymbol»
Multi-character symbol used for currency. Blank will use regional currency symbol.
«currencyPlacement»
One of these values:
0 = $-x
1 = -$x
2 = -x$
3 = $x-
4 = x$-
5 = x-$
6 = ($x)
7 = (x$)
8 = use regional setting
«datetemplate»
A string composed of these fields
y = Two digit year with no leading zero, e.g., 5
yy = Two digit year, e.g., 05
yyyy = Four digit year, e.g., 2005
M = Numeric month (no leading zero), e.g., 4
MM = Numeric month w/leading zero, e.g., 04
MMM = Abbreviated month, e.g., Apr
MMMM = Full month name, e.g., April
d = day of month, e.g., 9
dd = day of month w/leading zero, e.g., 09
ddd = abbreviated ordinal day of month, English only, e.g., 9th
dddd = Ordinal day of month, English only, e.g., ninth
Dddd = Ordinal day of month, capitalized, e.g., Ninth
www = Abbreviated weekday name
wwww = Weekday name, e.g., Saturday
q = quarter, 1 through 4, e.g., 2
LONG : regional long date format, e.g., Saturday, April 9, 2005
SHORT: regional short date format, e.g., 4/09/05
ABBREV : abbreviated version of long date format, e.g., Tue, Apr 9, 2005
SABBREV : abbreviated version of long date format w/o weekday, e.g., Apr 9, 2005
SLONG : regional long date with weekday stripped, e.g., April 9, 2005
’’’’ : A single quote, e.g., "MMM ’’’’yy" would be to produce "Apr '05"
The doubled ' inside escapes the '.
Literal characters: /, -, [dot], [space], [comma]
'text' : literal text, e.g., 'Q'q could produce Q2
«fullPrecision»
(optional), 0 or 1 (default 0) : whether full precision is required always

History

In Analytica 1.0 through 3.1, the NumberFormat was:

1, formatcode, digits, zeroes, separators, currency

where:

First field is version number

«formatcode»
is one of:
D: Suffix
E: Exponential
F: Fixed point
I: Integer
%: Percent
DD: Date
DB: Boolean
«digits»
Specified number of digits for exponent and suffix types, or the date type as follows:
0 = Short
1 = Long
2 = Abbrev
«zeroes»
Number of digits after the decimal in fixed point and percent formats.
«separators»
0 or 1, whether commas are used
«currency»
0 or 1, whether currency symbol is shown

See Also

Comments


You are not allowed to post comments.