{RANDOM} generates cells of random values drawn from a selected distribution. It is equivalent to the Random Number analysis tool. {RANDOM} has a different format for the following distribution types:
Uniform Every value has an equal probability of being selected.
Normal Has the qualities of a symmetrical, bell-shaped curve.
Bernoulli Has two possible outcomes, failure or success, represented by 0 and 1.
Binomial Represents the distribution of successful outcomes in a given number of independent Bernoulli trials.
Poisson The distribution of values in any interval depends on the length of the interval and the constant Lambda, the expected number of occurrences in an interval
Patterned A pattern of repeated values and sequences.
Discrete Every value in designated cells has a specified probability of being selected (the cumulative probabilities equal 1).
When the Distribution argument equals 7, {RANDOM} generates random values drawn from a discrete distribution.
Parameters
OutBlock Upper-left cell of the output cells
Columns A value indicating the number of random-number sets to generate; default is the number of columns in OutBlock
Rows A value indicating the number of rows of random numbers to generate for each column
7 Indicates discrete distribution
Seed Starting number for the random-number-generation algorithm
InBlock One or more numeric cell values representing the input cells, which contain a range of values and their probabilities, each in a separate column
{RANKPERC} returns the ordinal and percent rank of each value in InBlock. {RANKPERC} is equivalent to the Rank and Percentile analysis tool.
Parameters
InBlock Input cells containing one or more columns or rows of numeric values
OutBlock Upper-left cell of the output cells
Grouped "C" to group results by column or "R" to group results by row; the default is "C"
Labels 1 if labels are located in the first column or row of the input cells; 0 if the input cells do not contain labels; the default is 0
{READ}
Syntax
{READ #Bytes,Location}
Description
{READ} reads #Bytes bytes of characters from a file previously opened using {OPEN} (starting at the current position of the file pointer), and stores them as a label in Location. The file is left unchanged, and the file pointer moves to the position following the last character read. (See {GETPOS} for a discussion of the file pointer.)
{READ} is similar to {READLN}, except for two differences. While {READLN} reads one line of characters (terminated by a carriage-return/linefeed pair), {READ} reads the precise number of characters specified. This lets you read, for example, fields within a record rather than an entire record. The second difference is that while {READLN} strips out the carriage-return/linefeed pair at the end of a line, {READ} manipulates these as if they were no different from other characters. If you use {READ} to read a file created by {WRITELN}, you will see two graphics characters at the end of each string read. These are the carriage return and linefeed characters. {READ} is best used only in conjunction with {WRITE}, or when you know the text file structure in detail.
If {READ} succeeds, macro execution continues in the cell below the cell containing the {READ} command; if {READ} fails, macro execution continues in the same cell.
Example
This macro opens a text file containing a phone directory database, and reads a name and phone number from the third record. The macro that created this text file is shown in the description of {WRITE}:
\L {OPEN "A:PHONEDIR.PRN",R}
{SETPOS rec_length*(rec_number-1)}
{READ name_length,name}
{READ phone_length,phone}
{CLOSE}
rec_number 3
rec_length 28
name_length 14
phone_length 12
name Hall, Sue Ann
phone 617-555-5678
Parameters
#Bytes Number of bytes of characters to read from a file
Location Cell in which to store the characters read
{READLN}
Syntax
{READLN Location}
Description
{READLN} is like {READ}, but instead of using a number of bytes to determine the amount of text to read, {READLN} reads forward from the current file pointer location up to and including the carriage-return/linefeed at the end of the line. Unlike {READ}, it does not read the carriage return/linefeed into the cell. (See {GETPOS} for a discussion of the file pointer.)
Use {READ} to read lines from a record-structured file, where the lines are of uniform length. {READLN} can read the contents of a file one row at a time, making formatting of the data easier than {READ}.
Like the other file-access macros, if {READLN} fails, the macro continues execution in the current cell. If it is successful, the macro skips to the row below, and execution continues there. {ONERROR} can be used to trap disk and file errors, such as a disk drive door being left open.
Example
The following macro opens the text file TEST.TXT, reads in a line, and calculates the length of the line by subtracting the starting position from the ending position, then subtracting 1 from the result. This adjustment is necessary because the carriage-return and linefeed characters found at the end of each line in a typical text file are stripped away by Quattro Pro when the text is read into cells. The macro that created the file TEST.TXT is shown in the description of {WRITELN}.
\M {OPEN "A:TEST.TXT",R}
{GETPOS start}
{READLN input}
{GETPOS end}
{CLOSE}
{LET num_char,+(end-start)-1}
start 0
end 22
num_char 21
input This is a short line.
Parameters
Location Cell in which to store the characters read
{RECALC} causes Quattro Pro to recalculate a specified portion of the notebook in a row-by-row order. This is different from normal recalculation, where Quattro Pro recalculates the entire notebook in natural order; that is, before a formula calculates, each cell it references is recalculated first.
With the optional Condition argument, you can tell Quattro Pro to recalculate formulas in cells repeatedly until the specified condition is met. You can also supply Iteration# to specify the maximum number of times to recalculate formulas trying to satisfy Condition. To use Iteration#, Condition must also be supplied.
{RECALC} is useful for rapid recalculation of specified parts of a notebook, particularly when the notebook is so large that global recalculations would significantly slow your work.
{RECALC} overrides the recalculation method specified for the notebook, enforcing row-by-row recalculation. If all the formulas reference only cells above, or to the left in the same row, the notebook will be correctly calculated. If there are references to cells to the left and below, you must use {RECALCCOL}. If there are references to cells below or to the right in the same row as your formula, you must use {CALC} to recalculate the entire notebook.
{RECALC} displays the results of recalculation.
If there are formulas within the cells being recalculated that depend on formulas outside of the cells, they might not evaluate correctly. Make sure Location encompasses all the cells referenced by formulas within the cells.
Parameters
Location Cells to recalculate
Condition Condition to be met before recalculation is halted (optional)
Iteration# Maximum number of times to recalculate Location trying to meet Condition (optional)
{RECALCCOL} recalculates the specified portion of a notebook in column-by-column order. It is similar to {RECALC}, which recalculates row by row. See {RECALC} for information on when {RECALCCOL} is appropriate and when you need to use {CALC} instead.
Parameters
Location Cells to recalculate
Condition Condition to be met before recalculation is halted (optional)
Iteration# Maximum number of times to recalculate Location trying to meet Condition (optional)
{RefreshMenuBar}
Syntax
{RefreshMenuBar}
PerfectScript Syntax
RefreshMenuBar ()
Description
Refreshes the menu bar.
{RefreshScreenOn} and {RefreshScreenOff}
Description
{RefreshScreenOn} and {RefreshScreenOff} turn on or off the repainting of Quattro Pro behind an active dialog box.
{REGRESS} performs multiple linear regression analysis. {REGRESS} is equivalent to the Advanced Regression analysis tool.
Parameters
InBlockY Input cells containing a single column of y values (the dependent variables)
InBlockX Input cells containing one or more columns of x values (the independent variables)
YIntZero 1 if the y-intercept is 0 (the line of regression passes through the origin); 0 if the y-intercept is not 0
Labels 1 if labels are located in the first column or row of the InBlockY and InBlockX; 0 if the input selections do not contain labels
Confidence A value indicating the confidence level to apply to the regression
SumOutBlock Upper-left cell of the output cells for the summary table (allow at least seven columns)
Residuals 1 or 0; if 1, includes residuals in the output table
StdResiduals 1 or 0; if 1, includes standardized residuals in the output table
ResidualOutBlock Upper-left cell of the output cells for the residuals table (allow at least four columns)
ProbOutBlock Upper-left cell of the output cells for the probabilities table (allow at least two columns)
{Regression}
Syntax
{Regression.Option}
PerfectScript Syntax
Regression_Dependent (Block:String)
Regression_Go ()
Regression_Independent (Block:String)
Regression_Output (Block:String)
Regression_Reset ()
Regression_Y_Intercept (Mode:String)
Description
{Regression} performs a regression analysis to show the relationship between a set of independent variables and a dependent variable.
{Regression.Dependent} indicates the dependent-variable cells. {Regression.Independent} defines the independent variables. In {Regression.Independent}, Block can be noncontiguous with one variable to a column. The dependent and independent selections must all have the same number of rows.
{Regression.Output} indicates where to store the table of regression results. {Regression.Y_Intercept} specifies whether to compute the Y-intercept, or set it to zero. You can use {Regression.Reset} to clear all settings. Use {Regression.Go} after the other command equivalents to perform the regression analysis. If data changes within the independent or dependent data selections, use {Regression.Go} again to calculate a new regression table.
You can use {Regression?} or {Regression!} to display the Linear Regression dialog box. {Regression?} lets you manipulate the dialog box, whereas {Regression!} relies on the macro to manipulate it.
Example
The following macro sets these data selections: Independent, B2..D16; Dependent, F2..F16. The last statement performs the regression analysis and stores the results in the cells with upper-left cell H2.
{Regression.Independent A:B2..A:D16}
{Regression.Dependent A:F2..A:F16}
{Regression.Output A:H2}
{Regression.Go}
Options
{Regression.Dependent Block} Specifies the cells (partial column) containing independent variable (y-axis) data
{Regression.Go} Performs the regression analysis
{Regression.Independent Block} Specifies cells containing up to 150 columns of independent variable (x-axis) data
{Regression.Output Block} Specifies the cells where results will be written
{Regression.Reset} Clears all regression settings
{Regression.Y_Intercept Compute|Zero} Specifies whether to force the y-intercept value to zero or whether to compute it
{REQUEST} gets information specified by DataToReceive from applications that support Dynamic Data Exchange (DDE). This information is stored in DestBlock. DataToReceive is a string representing the location of the data to receive in the other application. In Quattro Pro, this could be cells such as A2..A7 or a property such as "(Application.Display)". If requesting a property, the property must be enclosed in parentheses. You must use {INITIATE} to open a channel of communication and obtain the value DDEChannel before using {REQUEST}.
If your conversation is not within a specific topic (in other words, you opened the channel using the command {INITIATE AppName,"System",DDEChannel}), you can use the following strings in DataToReceive, depending on the application:
Arguments for DataToReceive
String Purpose
"SysItems" A listing of all strings you can use with DataToReceive. You can use this command first to view other choices offered by AppName.
"Topics" A listing of all topics open. For example, a list of open documents under Word for Windows.
"Status" The current status of the application. For example, READY in Excel or EDIT in Quattro Pro when a cell is being edited.
"Formats" A list of all Clipboard formats supported by the application or DDE link.
"Selection" A list of all items currently selected in the application. For example, in Excel cells A3..A47 could be selected.
Example
This macro gets the major and minor version numbers of GroupWise, which is already running.
{RESIZE} resizes all selected objects in the active window (dialog or chart window).
Parameters
x and y XY coordinates of the new upper-left corner, in pixels
NewWidth The new width, in pixels, of the object or group
NewHeight The new height, in pixels, of the object or group
VertFlip? 1 if the object or group is flipped vertically from its previous position
HorizFlip? 1 if the object or group is flipped horizontally from its previous position
{ResizeToSame}
Description
{ResizeToSame} lets you resize selected objects in the dialog window to the same size as the first object selected.
{RESTART}
Description
{RESTART} changes the current subroutine to the starting routine (or the main routine) by removing all preceding For loops and subroutine calls.
{RESTART} is typically used for error handling. If an application is already nested to near the maximum number of levels and a severe error occurs that requires the macro to end, {RESTART} ensures that additional subroutine calls can be made. If you use the {RESTART} command often, you may want to use {BRANCH} to run subroutines.
{RestrictInput}
Syntax
{RestrictInput.Option}
PerfectScript Syntax
RestrictInput_Enter (Block:String)
RestrictInput_Exit ()
Description
{RestrictInput.Enter} enters INPUT mode and stays under macro control until {PAUSEMACRO} is used or {RestrictInput.Exit}, which exits INPUT mode.
{RestrictInput.Option} confines selector movement to specific cells of unprotected cells.
You can use {RestrictInput?} or {RestrictInput!} to display the Restrict Input dialog box. {RestrictInput?} lets you manipulate the dialog box, whereas {RestrictInput!} relies on the macro to manipulate it.
Options
{RestrictInput.Enter Block} Enters INPUT mode and stays under macro control
{RestrictInput.Exit} Any operation that ends INPUT mode
{RETURN}
Description
{RETURN} ends the executing subroutine and returns control to the macro that called it. If the macro executing is not a subroutine, execution stops.
A {RETURN} command at the end of a subroutine is optional, since a macro automatically returns from a subroutine when it reaches a blank cell or a cell containing a value. {RETURN} is usually used with {IF} to return to the main macro if a certain condition is met.
See {Subroutine} for an example of using {RETURN}.
{ReturnErrorValue}
Syntax
{ReturnErrorValue}
PerfectScript Syntax
ReturnErrorValue ()
Description
Reinstates the ability for Quattro Pro to return a specific error value, if one is warranted.
{RIGHT} and {R}
Syntax
{RIGHT <Number>} or {R <Number>)
Description
{RIGHT} and {R} are equivalent to the Right-arrow key. The optional argument Number moves the selector the corresponding number of columns to the right. You can also use cell references or cell names as arguments.
Example
{RIGHT}{RIGHT} moves right two columns.
{R 6} moves right six columns.
{RIGHT D9} moves right the number of columns specified in cell D9.
{RIGHT count} moves right the number of columns specified in the first cell of the selection named count.
{ROWCOLSHOW} lets you hide or reveal rows and columns (it is equivalent to the cell property Reveal/Hide). Show? specifies whether to reveal (1) or hide (0). Row or Col specifies whether to affect rows (1) or columns (0). Block contains the rows or columns to affect. FirstPane? is used when the active window is split into panes. To affect the columns or rows in the left or top pane, set FirstPane? to 1; to affect rows or columns in the right or bottom pane, set FirstPane? to 0.
Example
{ROWCOLSHOW A:A..B,1,0,1} reveals columns A and B on sheet A.
{ROWCOLSHOW A:1..7,0,1,1} hides rows 1 through 7 on sheet A.
{ROWCOLSHOW A:1..7,1,1,0} reveals rows 1 through 7 on sheet A. If the window is split, the rows are revealed in the right or bottom pane.
Parameters
Block Cells containing rows or columns to hide or show
Show? 1 to reveal rows or columns; 0 to hide rows or columns
Row or Col 1 to reveal or hide a row; 0 to reveal or hide a column
FirstPane? 1 to affect rows or columns in left or top window pane; 0 to affect them in the right or bottom window pane
{ROWHEIGHT} provides two ways to change the height of a row or rows (it is equivalent to the cell property Row Height). The rows to change are specified by Block. FirstPane? is used when the active window is split into panes. To resize the rows in the left or top pane, set FirstPane? to 1; to resize the rows in the right or bottom pane, set FirstPane? to 0.
Set/Reset specifies how to change the height. To set a row height, use this syntax: {ROWHEIGHT Block, FirstPane?, 0, Size}
Size is the new row height, in twips. The maximum height is ten inches (14,400 twips).
To reset a row to the default height (determined by font sizes in the row), use this syntax: {ROWHEIGHT Block, FirstPane?, 1}
Example
{ROWHEIGHT A:1..A:2,1,0,1440} sets the height of rows 1 and 2 (on sheet A) to one inch (1,440 twips).
{ROWHEIGHT A:1..A:2,0,0,2160} sets the height of rows 1 and 2 (on sheet A) to one and a half inches (2,160 twips). If the window is split, the top or left pane is affected.
{ROWHEIGHT A:5,1,1} resets the height of row 5 (on sheet A) to the default height.
Parameters
Block Cells containing rows to resize
FirstPane? 1 to resize rows in left or top window pane; 0 to resize rows in right or bottom window pane
Set/Reset 0 to set the row height; 1 to reset the row height
Size New height (in twips) if setting size; not needed if resetting size