home *** CD-ROM | disk | FTP | other *** search
/ Carousel Volume 2 #1 / carousel.iso / mactosh / utilfil / datadoct.sit / DataDoc.doc < prev    next >
Text File  |  1987-05-23  |  19KB  |  378 lines

  1.  
  2.  
  3.  
  4.  
  5.                        ###   DataDoctor   ###
  6.  
  7.  
  8.     DataDoctor started out as a simple utility to insert tabs between the
  9. observations of a data set or to replace tabs with spaces.  But I found that
  10. in the process of reading and writing a data file, the observations were
  11. converted to a form that allowed selection and modification.   As a result, 
  12. DataDoctor grew into a major tool for data editing and manipulation.
  13.  
  14.     Along with its original Tab function, DataDoctor allows you to modify
  15. your data in a number of ways.  You can request that only certain columns be
  16. written to your output file.  Or you can specify that only those rows be
  17. written for which a decision variable falls within a specified range. You can
  18. add dummy variables, a serial index or  a constant variable, you can designate
  19. certain columns as row labels, and you can replace all occurances of one value
  20. with another. Furthermore, you can do all this to data files that are too
  21. large to be handled in any other way.
  22.  
  23.  
  24.  
  25. GETTING STARTED:
  26.  
  27.     DataDoctor will read any ASCII (text) file regardless of what's in it. 
  28. That means you can tell it to open up a data set or the rough draft of your
  29. first novel.  It's really only useful with the data set however.
  30.  
  31.     There is no limitation on file size, so you can read/write a 500k data
  32. set as easily as a 5k set.  It just takes longer.  The only real limitation is
  33. on number of variables.  At this time, DataDoctor is restricted to 18 original
  34. variables and 4  'extra' ones.  Your data set can have more variables than
  35. this, but only the first 18  (+4) will be processed.
  36.  
  37.     After you choose an input file, DataDoctor will ask for an output file. 
  38. Make sure that there is plenty of room on the output disk.  Once
  39. reading/writing operations have begun, the program checks to make sure there
  40. is always at least 5k of disk space.  It will stop  and close your files if
  41. this limit is reached.
  42.  
  43.     After designating input and output files, a full screen dialog window
  44. appears.  The top half is a variable list, with check boxes, variable numbers
  45. and variable names.  If your data set has a 'column heading' row, then the
  46. variable names will be just what you want.  If your data set starts
  47. immediately with rows of observations, then the variable names will be the
  48. observations themselves.  If your data set starts out with a blank line, at
  49. title, or other information,then either specious variable names will appear or
  50. there will be no variable names at all.  Click the 'Read Another Line' button
  51. until you get to either a heading row or to a real row of data.
  52.  
  53.     Select the columns you want written to your output file by clicking the
  54. check box beside the variable you want.  If you want all variables, click the
  55. 'Select All' button.   (You can also 'unselect all' with this button.)
  56.  
  57.     Note that DataDoctor is quite dependent on the number and placement of
  58. variables in the variable list.  It uses this heading information throughout
  59. the program to keep track of which columns you have selected and to test your
  60. decision variable or function.  So be very careful that you keep skipping the
  61. lead-in lines of a data set until you have come to a row that is fully
  62. representational.  (If you overshoot, unfortunately you can't back up, but you
  63. can startover at the top of the input file by clicking 'Start Over'.)
  64.  
  65.  
  66.  
  67. ADDING EXTRA VARIABLES:
  68.  
  69.     If your data set includes columns that do not have a heading (or do not
  70. have an observation in the row you designate as the variable list), you can
  71. add up to three 'extra' trailing variables.  Here's an example:
  72.  
  73.        Stock        Price      Volume        Shares
  74.         ABC          4.56        789           876
  75.         DEF          3.45        678           901
  76.         ...           ...        ...           ...
  77.         ...           ...        ...           ...
  78.         GHI          6.78        901           234        .111
  79.         JKL          9.01        234           567            
  80.         MNO          2.34        567           890        .222
  81.  
  82. (If you are not reading this in 9 pt Monaco, the columns in this and the
  83. following examples will not 'line up'.  You may want to switch fonts before
  84. continuing.)    The last column here does not have a column heading.  Skipping
  85. rows until you get to a representative row will waste data since the first
  86. observation does not appear for a number of rows.  This is exactly the case in
  87. which you would want to add an extra variable.  If you don't add the extra
  88. variable to the variable list, the last column of observations will never be
  89. read.
  90.  
  91.     Extra variables are automatically added to the _end_ of each row, so if
  92. your unlabled observations are in middle columns, you will need to do some
  93. renaming of column headings.
  94.  
  95.     Many data sets come with labels in the fist column.  If this 'label'
  96. column doesn't have a heading in the variable list, then all of your data will
  97. be misread.  Here's an example:
  98.  
  99.                    Price       Volume        Shares       Divs
  100.         ABC         4.56         789           876
  101.         DEF         3.45         678           901
  102.         ...          ...         ...           ...
  103.         ...          ...         ...           ...
  104.         GHI         6.78         901           234        .111
  105.         JKL         9.01         234           567            
  106.         MNO         2.34         567           890        .222
  107.  
  108. If you don't correct this, DataDoctor will read your rows like this:
  109.  
  110.        Price        Volume       Shares        Divs
  111.         ABC          4.56          789          876
  112.         DEF          3.45          678          901
  113.         ...           ...          ...          ...
  114.         ...           ...          ...          ...
  115.         GHI          6.78          901          234        .111
  116.         JKL          9.01          234          567            
  117.         MNO          2.34          567          890        .222
  118.  
  119. In this case, you could simply skip a row to get to one that has a 'Stock'
  120. observation, but you would then lack a 'Divs' column and would either lack
  121. descriptive column headings or, if you replaced the observations with variable
  122. names, would loose a row of data.  To deal with this situation, DataDoctor
  123. allows you to add a leading variable to the variable list.  (Sorry, only one
  124. is provided for.)  This moves all the subsequent headings over by one
  125. position.  
  126.  
  127.     If your data has observations that include separate words, then each
  128. word will be considered an observation, which is something you may not want. 
  129. To get around this, DataDoctor allows you to specify label columns.  The
  130. observations in the label columns are written to the end or beginning of a row
  131. with no spaces separating the labels.  For example, suppose your variable list
  132. looked like this:
  133.  
  134.         A B C         4.56        789        876
  135.  
  136. The name of the stock is ABC, but this variable list is going to generate 6
  137. variables: 3 for the stock name and 3 for the other observations. 
  138. Furthermore, the stock name will end up being written as:  A <tab> B <tab> C 
  139. if you choose tab delimiters.   To avoid this, you can designate up to 3
  140. columns as labels.    Above, you would choose variable numbers 1,2, and 3 to
  141. be labels.  You may then want to deselect variables 1,2, and 3 from the
  142. variable list - otherwise they will appear twice: once as a variable, then
  143. again as part of a label. (A column can be both a regular variable _and_ a
  144. label simultaneously.)  If you do this with the above data and choose trailing
  145. labels, your rows will be written as follows:
  146.  
  147.                       4.56        789        876       ABC
  148.  
  149.     You can choose whether the labels are leading (at the beginning of a
  150. row) or trailing (at the end of the row).  For spreadsheet use, you will
  151. probably want leading labels.  For many statistics programs, trailing labels
  152. are necessay.
  153.  
  154.  
  155.  
  156. CHOOSING A DECISION VARIABLE:
  157.  
  158.     DataDoctor allows you to select a range of data to be written to your
  159. output file.  To do this, first determine which variable you want to be your
  160. decision variable.  Make sure the 'Decision Variable' box is selected, then
  161. click on the name of the variable (not the number and not the check box) in
  162. the variable list.  For example, in a set of stock prices, to choose
  163. 'Dividend' as a decision variable just click on the variable name 'Dividend'. 
  164. The variable name will appear in the highlighted decision variable box and its
  165. variable number will appear above it.  If you change your mind, just click on
  166. another variable.  If you want no decision variable, deselect the decision
  167. variable check box.
  168.  
  169.     Next set the range for your decision variable.  Type in a number in the
  170. lower bound box and another in the upper bound.  Note that your decision
  171. variable and its range _must_ be numeric.  You can't have a decision variable
  172. containing pet names with a range of 'cat' to 'dog'.  If dividend yield is
  173. your decision variable, you might type in .03 for the lower bound and .08 for
  174. the upper bound.  You cannot enter 3% and 8% because '%' is not numeric.  In
  175. fact, you could not use 'dividend yield' as a decision variable if the yields
  176. were expressed in '%'s.  (It's unfortunate but true that '$' is also not
  177. numeric, so you can't use a decision variable that is expressed in $ amounts. 
  178. Exponential notation is also not numeric.  If you have floating point data
  179. expressed as, say, 9.24E02, then this variable cannot be used as a decision
  180. variable.)
  181.  
  182.  
  183.  
  184. DEFINING A DECISION FUNCTION:
  185.  
  186.     Instead of choosing a single variable as a decision variable, you can
  187. define a decision function.  Click the Decision Function button and a window
  188. will appear.  Enter a variable number for both the X and Y variables. (Both
  189. must be designated.  If you skip one, an alert will remind you.)  Then enter a
  190. numeric value for each of the constants.  Finally, determine what operations
  191. you want done.  For example, you might choose X as 'dividend-yld', Y as
  192. 'capital_gain', c1 as 0.0 and c2 as 0.0.  Then (X + c1) + (Y + c2) will give
  193. you dividend yield plus capital gain i.e. the total return on a stock.  This
  194. 'Total Return' is now your decision variable.  Only rows of stock observations
  195. that have a 'total return' between the specified upper and lower bounds will
  196. be written to your output file.
  197.  
  198.     Thre are two important things to note about the Decision Function. 
  199. First, it slows down output by quite a bit.  This isn't important for small
  200. files but may become very boring with big files.  Secondly, DataDoctor has
  201. only limited error checking abilities.  A complex decision function could
  202. possibly crash the program if irrational values are generated by the function. 
  203.  
  204.  
  205.  
  206. ADDING AN INDEX OR CONSTANT:
  207.  
  208. If you click the Add Variables button, a dialog will appear asking you to
  209. identiy the variables you wish to add.  Four of these were discussed already
  210. i.e. the leading and trailing extra variarables.  But in addition, you may add
  211. an index variable and/or a constant variable.  Either of these can be made
  212. into labels if you prefer.  
  213.  
  214.     The index can be used as a very versatile counter.  Note that you can
  215. set its starting point and increments.  The constant variable may not seem
  216. particularly useful at first, but it can be very valuable for tagging sorted
  217. data sets and creating dummy variables.  For example, you can output a
  218. selected set of data tagged with, say, 1 and merge this with another selected
  219. set of data tagged with 0.  You now have a dummy variable (a column of 1's and
  220. 0's) for a regression analysis.
  221.  
  222.     Any of the Extra Variables can be used as a decision variable, although
  223. I'm not sure why anyone would want to use the Constant.  The other variables,
  224. however, can be very useful.  Using the Index as a decision variable, you can
  225. specify that only a certain number of rows be output.  Using one of the blank
  226. Extra's you can specify that only those rows for which that variable has value
  227. will be output.  Byt the way, since the decision variable must be numeric,
  228. blank Extra variables are translated to '0' and output that way.  So if you
  229. want to change blank observations to '0', make the column involved a decision
  230. variable with -1 as a lower bound.
  231.  
  232.  
  233.  
  234. CHANGE NAMES:
  235.  
  236.     This button calls up a window that does just what it sounds like.  It
  237. lets you edit your column headings as you wish.  Only about 12 characters of
  238. the name will apear in the opening window's variable list, but the whole name
  239. will be written to your output file.
  240.  
  241.     If you have a data set with no headings and you want to create a set,
  242. skip lines until you get to the first true row of your data.  Then use Change
  243. Names to change each observation value to a variable name.  This row then
  244. becomes your heading.  Be aware that this destroys the first row of data - so
  245. only do this if you have data to spare.
  246.  
  247.     Note that you _cannot_ create variables with Change Names.  The dialog
  248. will be perfectly happy to let you type in extra names, and the main window
  249. will display these names, but you cannot select them as variables because they
  250. actually don't exist.
  251.  
  252.     Nor can you remove variables with Change Names.  If you delete a name,
  253. the variable position still exists but is nameless.
  254.  
  255.  
  256.  
  257. REPLACE VALUES:
  258.  
  259.     DataDoctor is very lenient about what form observations take.  The only
  260. time the actual type and value of the observation matters is for the decision
  261. variable or function.  But your statistics or charting program may feel
  262. otherwise.  If your data is filled with periodic 'n.a.'s to represent missing
  263. values, you may want to use Replace Values to change all of these 'n.a.'s to,
  264. say, -999. 
  265.  
  266.     The Replace Values function is _very_ limited and persnickity.  It
  267. looks only at whole observations, not parts.  So it will only replace a value
  268. if the whole observation exactly equals what you have typed into the Replace
  269. Values window.  For example, if you request that 'Sept' be replaced, an
  270. observation of 'sept' will not be replaced.  Be very careful about how you
  271. type in your request.  If you typed in 'n.a._' or '_n.a.' (with a leading or
  272. trailing blank) then only 'n.a.' observations with this leading or trailing
  273. blank will be replaced.
  274.  
  275.  
  276.  
  277. OTHER UTILITIES:
  278.  
  279.     No LFs versus Add LFs  -  Mainframes and the Macintosh seem to have
  280. very different ideas about linefeeds.  If you have downloaded a linefeed
  281. filled  dataset (the linefeeds appear as little boxes), you may want to get
  282. rid of them.  If you are uploading a dataset, some computers require that you
  283. add linefeeds; otherwise all the data tries to cram itself into one line. 
  284. DataDoctor will always remove linefeeds (it basically just ignores them)
  285. unless you tell it to do otherwise.
  286.  
  287.     Tabs versus Spaces  -  DataDoctor has to separate your observations
  288. with something.  If you choose spaces, it will insert 3 spaces between each
  289. observation.  If you choose Tabs, it will insert 1 tab and 2 spaces between
  290. each observation.  Please let me know if you would like other delimiters, like
  291. commas, semicolons, etc.
  292.  
  293.     Please note that DataDoctor is not designed to turn your data into a
  294. 'report quality' formated table.  Your output data will not necessarily appear
  295. in nice straight columns.  The intent of the program is to convert your data
  296. to a form that will be easily read by other programs, not other humans.
  297.  
  298.  
  299.  
  300. INPUT/OUTPUT:
  301.  
  302.     Once you have made all the selections you need in the opening window,
  303. click OK.  DataDoctor will begin processing your data immediately.  While it's
  304. doing this, an Input/Ouput Progress window will show what's happening.  You
  305. can pause the program at anytime by clicking Pause and can view the current
  306. output record by clicking View.  (You should do this at least once to make
  307. sure the output set looks like what you intended.  Did you select the right
  308. variables?  Is your Replace request working?)
  309.  
  310.     You can quit at any time by clicking Quit.  Any data written to the
  311. output file at that point will be preserved.  Both your input and output files
  312. will be closed and you will exit the program.  Obviously this is something you
  313. will want to do if a large data set is being read past a specified range.  If
  314. nothing more is being written to the output file, you may as well quit.
  315.  
  316.     When the entire input file has been processed, the window will notify
  317. you with 'Finished'.  Click Quit and that's that.  Note that you do have to
  318. click the Quit button, even though all input/output has been completed.   The
  319. program does _not_ exit automatically.  There are two reasons for this. 
  320. First, you can leave the room, have some coffee, read a book, etc. while the
  321. program is working.  When you come back, you will see exactly how many rows of
  322. data were read and how many were actually written.  This may be very useful
  323. information.  Second, you may wish to append a second set of selected data to
  324. the first set in the output file.
  325.  
  326.     Clicking Append closes the input file but not the output file.  A
  327. dialog will ask you for a new input file.  (You can choose the same one if you
  328. wish.)  The opening window will then appear allowing you to make whatever
  329. selections you need.  You can redefine your decision function, add variables
  330. or do whatever else you wish.  Clicking OK brings you back to the Input/Output
  331. Window where you will see (from the 'write' counter) that the new data set is
  332. being added on to the original output file.
  333.  
  334.  
  335.  
  336. SOME OBSERVATIONS AND CAVEATS
  337.  
  338.     DataDoctor is my first attempt at a full blown Macintosh application. 
  339. Writing it was very much a learning process.  As a result, there are a number
  340. of things lacking in the program. 
  341.  
  342.      *** First and Foremost ***   DataDoctor has only limited error
  343. checking.   I have tried to provide traps for obvious errors, but will
  344. certainly not have trapped every possibility.  The program may well crash if
  345. pressed too hard.  So _please_ make sure your data is backed up before running
  346. the program!
  347.  
  348.      DataDoctor runs fine on my MacPlus with a hard disk in a fairly
  349. complicated environment (i.e. with inits, fkeys, too many DA's etc.)  But I
  350. have no idea how it will do on other Macs.  It uses up a lot of memory space,
  351. so it may not work on a 128k Mac.
  352.  
  353.      Things I would like to add to DataDoctor include:
  354.           -menus and access to DA's
  355.           -speed  (I know it's slow.)
  356.           -ability to handle more than 18 variables.
  357.           -sorting ability
  358.           -full window views on the input and output files.
  359. If I can get speed up and size down, DataDoctor would be particularly useful
  360. converted to DA form. 
  361.          
  362.  
  363.     If there's a utility or ability you really want added, let me know. 
  364. And if you have problems, crashes or encounter general wierdnesses, please let
  365. me know about that too.
  366.  
  367.     DataDoctor was developed using Lightspeed Pascal, which is an
  368. absolutely wonderful programming environment.  Many, many thanks to Think
  369. Technologies!
  370.     
  371.                          Patricia Smith
  372.                              325 E. 79th St.
  373.                              NY,NY  10021
  374.                              CIS:  70655,425
  375.  
  376.  
  377.