home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
xactus.zip
/
macros
/
stat.xc$
/
xsmp32
/
os2
/
uk
/
stat.xcd
Wrap
Text File
|
1994-09-29
|
2KB
|
71 lines
/* try macro */
Parse Arg handle
Say "This macro opens a table document and " ||,
"defines and selects all columns. Then it computes the "||,
"descriptive statistics, extracts mean and standard deviation "||,
"and writes these to the end of the table document. "||,
"The resulting table document is then presented as a table "||,
"chart using a stylesheet."
tHandle = XR_OpenTab("TABLES\N10G8.XTF") /* Open the table */
Call XR_Select tHandle, "All", "SELECT" /* Select all columns */
Call XR_SetColTyp tHandle, "YL" /* Set column types */
newHandle = XR_Statistics(tHandle) /* Compute descr. statistics */
Call XR_SwapMatrix tHandle /* Rotate the data in the table */
Call getColumnValues newHandle, 2 /* get the mean values from the stat window */
colNo = setColumnValues(tHandle) /* and write them to the end of the table */
Call XR_WriteCell tHandle, 0, colNo, "Mean" /* set the colum title */
Call getColumnValues newHandle, 3 /* get the standard deviations */
colNo = setColumnValues(tHandle) /* and write them to the end of the table */
Call XR_WriteCell tHandle, 0, colNo, "Std.Dev." /* set the column title */
Call XR_CloseWindow(newHandle) /* close the stat window */
/* use a stylesheet and rescale */
gHandle = XR_UseStyleSheet(tHandle, "STSHEET\TAB.STL", 1)
Exit
/*************************************************************************
* getColumnValues
*
* Writes the values from column 'colNo' into the stem variable 'val'
*************************************************************************/
getColumnValues: procedure expose val.
Parse Arg handle, colNo
total = XR_NumOfLines(handle)
Do i = 0 To total
val.i = XR_ReadCell(handle, i, colNo)
End
val.0 = total
Return
/*************************************************************************
* setColumnValues
*
* Writes the values from the stem variable 'val' into a new column.
*************************************************************************/
setColumnValues: procedure expose val.
Parse Arg handle
colNo = XR_GetColNum(handle, 1, "UNUSED")
Do i = 1 To val.0
Call XR_WriteCell handle, i, colNo, val.i
End
Return colNo