Next: probit() Up: MacAnova Help File Previous: primefactors()   Contents


print(a, b, ...[,format:Fmt or nsig:m, header:F, labels:F,\
  missing:missStr, zero:zeroStr, name:setName, width:w, height:h,\
  macroname:T, file:fileName [,new:T]]]), Fmt, missStr, zeroStr,
  fileName, setName CHARACTER scalars, m > 0, w >= 30, h >= 12 integers

Keywords: output, missing values
print(a,b, ...) prints objects (variables, expressions, macros) a, b,

By default, print() formats REAL items using the format identified by
'format' on getoptions() output.  This normally is floating point with 5
significant digits.  Type help(options:"format") for details.

print() encloses macros and the elements of CHARACTER variables in
quotes ("").  Any internal quotes are escaped with '\' (for example
"\"Hello\"") and non-printable characters are printed as escaped octal
integers (for example, "\033" or "\177").

print(Message), where Message is a single quoted string or CHARACTER
scalar, prints Message just as it is, without enclosing quotes and
without any internal quotes and non-printable characters escaped.
print(Message, macroname:T) does the same, except that when executed in
a macro, " in macro XXXX" is appended to Message.  This is useful for
printing messages in a macro.

print(a,b,...,file:FileName [,new:T]) where FileName is a quoted string
or CHARACTER variable, writes the output to the specified file rather
than to the screen.  When new:T is an argument, any information in the
file is discarded before writing.  Otherwise, output is appended to the
end of the file.

When FileName is the variable CONSOLE or a CHARACTER variable whose
value is "CONSOLE", the output is written to the screen rather than to a
file.  The value of variable CONSOLE is ignored.

Keywords 'nsig', 'format', 'name', 'header', 'labels', 'missing' and
'zero' are all recognized and can appear more than once.  They affect
the printing of objects that follow them, until they are changed except
that a value for 'name' is used only once.  Any of them that follow all
items to be printed are treated as coming before all items.  For
  Cmd> print(x,nsig:5,y,nsig:10)
  Cmd> print(nsig:10,x, nsig:5,y)
are equivalent.

Keywords 'file' and 'new' can appear only once, anywhere in the argument

print(nsig:d,a,b,...) or print(a,b,...,nsig:d) prints numbers with d
significant digits in floating point format with width d+7.

print(format:Fmt,a,b,...) or print(a,b,...,format:Fmt), where Fmt is a
quoted string or CHARACTER variable, prints numbers according to
specifications given in Fmt. Fmt must be of the form "w.df" or "fw.d"
(fixed point) or "w.dg" "gw.d" (floating point) where w (field width)
and d (decimals or significant digits) are integers, for example "6.3f"
or "g15.7".  See below for details.

print(name:Name, a, b,... ) prints a with the name specified by
quoted string or CHARACTER scalar Name on the header.

Name can be of unlimited length aiding the creation of informative

  Cmd> print(3*log(640320)/sqrt(163), nsig:17,\
     name:"3*log(640320)/sqrt(163) is a good approximation to pi")
  3*log(640320)/sqrt(163) is a good approximation to pi:
  (1)       3.1415926535897931

A name specified using 'name' is used for only one output variable;
however, you can have several instances of name:Name, each affecting
the next variable output.

Alternatively, if the name is a legal MacAnova variable name no more
than 10 characters long you can use a keyword to specify the name.  For
example print(name:"Residuals", r) and print(Residuals:r) are

print(header:F,x,header:T,y,...,) prints x without and y with an
identifying name.

print(a,b,...,width:w) temporarily sets option 'width' to w, an integer
>= 30. This affects how many items are printed per line.

print(a,b,...,height:h) temporarily set option 'height' to h, an integer
>= 12.  This affects the number of lines in any graphs being printed as
"dumb" plots and how often output will be paused in non-windowed

print(labels:F,x,labels:T,y,...,) suppresses printing row and column
labels of x, and enables their printing for y.  When an object printed
does not have coordinate labels, the labels printed are just the index
or indices of the first element in each line.  See topic 'labels'.

print(missing:MissStr1,a,b,...), where MissStr is a quoted string or
CHARACTER variable such as "?" or "NA", specifies that all missing
values are to be printed using MissStr.  If 'missing' is not used,
missing values are printed as "MISSING" (or using a different default if
you changed it by setoptions(); type help(options:"missing")).  Note
that this differs from the use of 'missing' on matprint() and matwrite()
for which the value must be a REAL scalar.

print(x,file:FileName,new:T,header:F,labels:F,missing:"?") writes x to
the file in a form that can be read by vecread().

print(zero:ZeroStr,a,b,...), where ZeroStr is a quoted string or
CHARACTER variable such as " ", "0" or "ZERO" specifies that zero values
are to be printed using ZeroStr.  If 'zero' is not used, zero values are
printed using the same format as other numbers.

                   Details on value of 'format' keyword
If Fmt is "w.df" or "fw.d" (fixed point), or "w.dg" or "gw.d" (floating
point), integer w specifies a field width of at least w characters.  For
fixed point format, integer d is the number of digits that will follow
the decimal point.  For floating point format, d is the number of
significant digits printed.  If w is omitted (".3f" / "f.3" or ".7g" /
"g.7"), it is implicitly set to d+7 ("10.3f"/ "f10.3" or "14.7g" /
"g14.7").  If w > 27, width = 27 is assumed and if d > 20, digits = 20
is assumed.

With fixed point output, trailing zeros are kept; for floating point
output they are trimmed off.  For example, 10.30 is printed as
'10.30000' with "8.5f" or "f8.5" format and as '10.3' with "8.5g" or
"g8.5" format.

For floating point output, exponential form, 9.3e+07 for example, is
used if required to represent the number.

You can change the default format for print() and matprint() by
setoptions() using keywords 'nsig' or 'format'.  See topics
'setoptions', 'options'.

  print(nsig:5,a), print(format:"12.5g",a), and print(a,nsig:5),
are equivalent.
writes a to file "myfile", starting fresh.

  Cmd> print("Quoted because > 1 argument",vector("a","Escaped\1\2"))
  (1) "Quoted because > 1 argument"
  (1) "a"
  (2) "Escaped\001\002"

  Cmd> print("Not quoted because only 1 argument")
  Not quoted because only 1 argument

Other keywords are used to label output.  For example, the output
produced by 'print(eigenvals(x))' will be labeled 'VECTOR', but that
produced by 'print(Values:eigenvals(x))' will be labeled 'Values'.
Keywords may have no more than 10 characters.

This function is particularly useful inside macros and compound lines.

See also topics 'options', write(), matprint(), matwrite(), paste(),

Gary Oehlert 2003-01-15