xtshare

Section: User Commands (1)
Updated: 2002-10-26
Index Return to Main Contents

 

NAME

xtshare - calculates share

 

SYNOPSIS

xtshare -f attributes for computating shares [-k key attribute(s)] [-i INPUT] [-o OUTPUT] [-z] [-t] [-T TEMP DIRECTORY]

 

DESCRIPTION

xtshare calculates the share value of attribute -f within the records with the same key attribute. The share is derived from the record count on the attribute divided by the sum of all attributes with the same key value. If -k is not specified, all records are taken into account with the same key value. A new attribute for the share can be specified by -f attribute name: new attribute name.

 

PARAMETERS

-k key attributes
specify key attributes by which share is computed (if omitted, all lines are assumed to take the same key value.)
-f attribute(s)
a list of attributes where share is computed

 

OPTIONS

-i input filename
if a suffix of the filename is '.gz', the command acts as a filter, extracting t he compressed file for processing. The command will read the file as standard in put when "-i" is not specified.
-o output filename
if a suffix of the filename is '.gz', the command automatically returns the outp ut data in zip archive. When "-o" is not specified, the result will sent to stan dard output.
-T temp directory
specify the directory name for temporal files used in this command.
-z zip archive
compress the standard output to zip archive. When the option "-o" is not given a nd "-z" is specified, the output will be compressed as zip archive.
-t plain text
treats the input and output data as plain text format.

 

USAGE

Input file - dat.xt:
<field no="1">
<name>CustomerID</name>
</field>
<field no="2">
<name>Date</name>
</field>
<field no="3">
<name>TotalAmount</name>
</field>
<field no="4">
<name>TotalQuantity</name>
</field>
<body><![CDATA[
A00004 20020214 1 365
A00004 20020214 1 565
A00004 20020415 9 4349
A00004 20020214 3 650
A00005 20020918 12 4554
A00005 20020923 1 491
A00056 20021128 1 94
A00056 20021128 1 112
A00056 20021128 1 115
A00056 20021128 1 93
A00056 20021128 1 149
A00131 20020108 2 280
]]></body>

Example 1. Calculate the share of each item out of the total items purchased on the same date. e.g. xtshare -k customerID -f date:dairy_share -i dat.xt -o rsl.xt Output file -rsl.xt

<body><![CDATA[
A00004 20020214 1 365 0.249999
A00004 20020214 1 565 0.249999
A00004 20020214 3 650 0.249999
A00004 20020415 9 4349 0.250002
A00005 20020918 12 4554 0.5
A00005 20020923 1 491 0.5
A00056 20021128 1 112 0.2
A00056 20021128 1 115 0.2
A00056 20021128 1 149 0.2
A00056 20021128 1 93 0.2
A00056 20021128 1 94 0.2
A00131 20020108 2 280 1
]]></body>

 

DIAGNOSTICS

Attribute(s) specified by the -k parameter cannot be declared for -f at the same time. The result of xtshare on null attributes will return a null value. To avoid this, delete lines with null value by command xtdelnul, or convert null value with xtnulto to a numerical value such as zero.

 

SEE ALSO

xtagg(1), xtstatistics(1) For complete documentation and tutorial of xtshare and other commands, please visit http://musashien.sourceforge.net

 

BUG REPORT

If you find a bug in xtshare, please send an electronic mail to musashi@adm.osaka-sandai.ac.jp. Before sending a bug report, please verify that you have the lastest version of MUSASHI. Read this manual carefully to ensure the error is not caused by a quirk in the language.

 

AUTHORS

Yukinobu Hamuro, Naoki Katoh, Katsutoshi Yada, Stephane Cheung


 

Index

NAME
SYNOPSIS
DESCRIPTION
PARAMETERS
OPTIONS
USAGE
DIAGNOSTICS
SEE ALSO
BUG REPORT
AUTHORS

This document was created by man2html, using the manual pages.
Time: 22:43:55 GMT, June 24, 2003