SAS/IntrNet 9.2: htmSQL |
htmSQL supports formats in two different ways:
by providing the format=
parameter which enables you to explicitly specify a format with variable references
and directives.
by using the format that is associated with the data set column.
The following values can be used for the format=
parameter of htmSQL variable references and directives:
The following is an example of how to use this format:
{&abc format=(comma, 10.2)}
The following is an example of how to use this format:
{&abcx format=(commax, 10.2)}
The following are examples of how to use this format:
{&abc format=(dollar, 15.2)} {&abc format=dollar}
The following are examples of how to use this format:
{&abcx format=(dollarx, 15.2)} {&abc format=dollarx}
abc
has a value of -13454,
then if you use the following variable reference,
{&abc format=(exp, 10.3)}
htmSQL formats the value as -1.345e+04.
Special Character | Character Entity Reference |
---|---|
left angle bracket (<) | < |
right angle bracket (>) | > |
ampersand (&) | & |
double quotation mark (") | " |
Use this option if the variable's value includes special characters that should be rendered as is when the output Web page is displayed.
format=notrim
, htmSQL discards
trailing blanks in the variable value when it resolves the reference.
Note: Because most Web browsers collapse consecutive blank spaces,
the notrim format is
most effective when it is used with the <PRE>
HTML element.
linename
contains the string "line01",
then
:{&linename format=10}:
appears as
:line01 :
and :{&linename format=(right, 10)}:
appears as
: line01:
Note: Because most Web browsers collapse consecutive blank spaces,
the right format is
most effective when it is used with the <PRE>
HTML element.
Use this option when you include variable references in the values
for the ACTION
or HREF
attributes of HTML elements.
You can specify a value either for w, for d,
or for both. If you
specify d by itself, you
must precede it with a period (.). The value
for d is useful only for numeric values and is
ignored for variables containing character and integer values. Note that the
following format values are all equivalent:
format=8.
, format=8
,
and format=8.0
.
Note to SAS software users:
The htmSQL implementation of field widths (w) for numeric values differs from the SAS implementation. For SAS software, w is generally an absolute specification for the field width, and SAS software changes the formatting of the number to accommodate the width (by doing such things as reducing precision and changing formats). For numeric values in htmSQL, the w width specification is a minimum and is adjusted upward, if necessary, to accommodate the numeric value and the precision specifier (d).
The htmSQL implementation of field widths (w) for character data is the same as the SAS implementation. Both implementations indicate the exact number of characters to format, either truncating or blank-padding as necessary.
When you refer to a column in a query results set,
if you do not specify the
format=
parameter but the column has one of the following formats
associated with it, then htmSQL uses the associated
format to resolve the reference:
When you refer to a column in a query results set, if the column has a date, time, or datetime format associated with it, the following formats are used:
Regardless of what date format your column has,
htmSQL always outputs date
values as either ddMmmyy
or ddMmmyyyy
, where
dd
is the day of the monthMmm
is the first three letters
of the month of the yearyy
and yyyy
are
the last two and four digits of the year, respectively
(depending on the value of the
YEARDIGITS
run-time configuration option).
Regardless of what time format your column has,
htmSQL always outputs time
values as hh:mm:ss
, where
hh
is the hour of the day using a 24-hour clockmm
is the minute of the hourss
is the second of the minute.
Note that htmSQL does not handle fractions of seconds.
Regardless of what datetime format your column has,
htmSQL always outputs datetime
values as ddMmmyy hh:mm:ss
or
ddMmmyyyy hh:mm:ss
, where
dd
is the day of the monthMmm
is the first three letters of the month of the yearyy
and yyyy
are
the last two and four digits of the year, respectively
(depending on the value of the
YEARDIGITS
run-time configuration option)hh
is the hour of the day using a 24-hour clockmm
is the minute of the hourss
is the second of the minute.
Note that htmSQL does not handle fractions of seconds.Note: If you want to use other date, time, or datetime formats,
you can use the PUT()
function in
your SQL query to change the format.
Copyright © 2007 by SAS Institute Inc., Cary, NC, USA. All rights reserved.