Object Reference : Object View and Procedure Reference : Series
  
 
setformat
Set the display format for cells in a series object spreadsheet view.
Syntax
series_name.setformat 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.
For series, setformat operates on all of the cells in the series.
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 all cells in the series to fixed 5-digit precision, simply provide the format specification:
ser1.setformat f.5
Other format specifications include:
ser1.setformat f(.7)
ser1.setformat e.5
You may use any of the date formats given above:
ser1.setformat YYYYMon
ser1.setformat "YYYY-MM-DD HH:MI:SS.SSS"
to set the series display characteristics.
Cross-references
See Series::setwidth, Series::setindent and Series::setjust for details on setting spreadsheet widths, indentation and justification.