Set the display format for cells in a group spreadsheet view.
Syntax
group_name.setformat(col_range) format_arg
where format_arg is a set of arguments used to specify format settings. If necessary, you should enclose the format_arg in double quotes.
The col_range option is used to describe the columns to be updated in groups. It may take one of the following forms:
@all | Apply to all series in the group. |
col | Column number or letter (e.g., “2”, “B”). Apply to the series corresponding to the column. |
first_col[:]last_col | Colon delimited range of columns (from low to high, e.g., “3:5”). Apply to all series corresponding to the column range. |
first_series[:]last_series | Colon delimited range of columns (from low to high, e.g., “series01:series05”) specified by the series names. Apply to all series corresponding to the column range. |
To format numeric values, you should use one of the following format specifications:
g[.precision] | significant digits |
f[.precision] | fixed decimal places |
c[.precision] | fixed characters |
e[.precision] | scientific/float |
p[.precision] | percentage |
r[.precision] | fraction |
To specify a format that groups digits into thousands using a comma separator, place a “t” after the format character. For example, to obtain a fixed number of decimal places with commas used to separate thousands, use “ft[.precision]”.
To use the period character to separate thousands and commas to denote decimal places, use “..” (two periods) when specifying the precision. For example, to obtain a fixed number of characters with a period used to separate thousands, use “ct[..precision]”.
If you wish to display negative numbers surrounded by parentheses (i.e., display the number -37.2 as “(37.2)”), you should enclose the format string in “()” (e.g., “f(.8)”).
To format numeric values using date and time formats, you may use a subset of the possible date format strings (see
“Date Formats”). The possible format arguments, along with an example of the date number 730856.944793113 (January 7, 2002 10:40:30.125 p.m) formatted using the argument are given by:
WF | (uses current EViews workfile period display format) |
YYYY | “2002” |
YYYY-Mon | “2002-Jan” |
YYYYMon | “2002 Jan” |
YYYY[M]MM | “2002[M]01” |
YYYY:MM | “2002:01” |
YYYY[Q]Q | “2002[Q]1” |
YYYY:Q | “2002:Q |
YYYY[S]S | “2002[S]1” (semi-annual) |
YYYY:S | “2002:1” |
YYYY-MM-DD | “2002-01-07” |
YYYY Mon dd | “2002 Jan 7” |
YYYY Month dd | “2002 January 7” |
YYYY-MM-DD HH:MI | “2002-01-07 22:40” |
YYYY-MM-DD HH:MI:SS | “2002-01-07 22:40:30” |
YYYY-MM-DD HH:MI:SS.SSS | “2002-01-07 22:40:30.125” |
Mon-YYYY | “Jan-2002” |
Mon dd YYYY | “Jan 7 2002” |
Mon dd, YYYY | “Jan 7, 2002” |
Month dd YYYY | “January 7 2002” |
Month dd, YYYY | “January 7, 2002” |
MM/DD/YYYY | “01/07/2002” |
mm/DD/YYYY | “1/07/2002” |
mm/DD/YYYY HH:MI | “1/07/2002 22:40” |
mm/DD/YYYY HH:MI:SS | “1/07/2002 22:40:30” |
mm/DD/YYYY HH:MI:SS.SSS | “1/07/2002 22:40:30.125” |
mm/dd/YYYY | “1/7/2002” |
mm/dd/YYYY HH:MI | “1/7/2002 22:40” |
mm/dd/YYYY HH:MI:SS | “1/7/2002 22:40:30” |
mm/dd/YYYY HH:MI:SS.SSS | “1/7/2002 22:40:30.125” |
dd/MM/YYYY | “7/01/2002” |
dd/mm/YYYY | “7/1/2002” |
DD/MM/YYYY | “07/01/2002” |
dd Mon YYYY | “7 Jan 2002” |
dd Mon, YYYY | “7 Jan, 2002” |
dd Month YYYY | “7 January 2002” |
dd Month, YYYY | “7 January, 2002” |
dd/MM/YYYY HH:MI | “7/01/2002 22:40” |
dd/MM/YYYY HH:MI:SS | “7/01/2002 22:40:30” |
dd/MM/YYYY HH:MI:SS.SSS | “7/01/2002 22:40:30.125” |
dd/mm/YYYY hh:MI | “7/1/2002 22:40” |
dd/mm/YYYY hh:MI:SS | “7/1/2002 22:40:30” |
dd/mm/YYYY hh:MI:SS.SSS | “7/1/2002 22:40:30.125” |
hm:MI am | “10:40 pm“ |
hm:MI:SS am | “10:40:30 pm” |
hm:MI:SS.SSS am | “10:40:30.125 pm” |
HH:MI | “22:40” |
HH:MI:SS | “22:40:30” |
HH:MI:SS.SSS | “22:40:30.125” |
hh:MI | “22:40” |
hh:MI:SS | “22:40:30” |
hh:MI:SS.SSS | “22:40:30.125” |
Note that the “hh” formats display 24-hour time without leading zeros. In our examples above, there is no difference between the “HH” and “hh” formats for 10 p.m.
Also note that all of the “YYYY” formats above may be displayed using two-digit year “YY” format.
Examples
To set the format for a series in a group, provide the column identifier and format:
group1.setformat(1) f.5
sets the first series in GROUP1 to fixed 5-digit precision.
group1.setformat(2) f(.7)
group1.setformat(c) e.5
sets the formats for the second and third series in the group.
You may use any of the date formats given above:
group1.setformat(2) YYYYMon
group1.setformat(d) "YYYY-MM-DD HH:MI:SS.SSS"
The column identifier may be the series names. Assuming we have a group which contains the series A1, C1, B2, A5, and H2, in that order,
group1.setformat(c1:a5) p.3
sets the formats of the series C1, B2, and A5.
Cross-references
See
Group::setwidth,
Group::setindent and
Group::setjust for details on setting spreadsheet widths, indentation and justification.