Administrative functions > Data conversion programs > Convert tables into comma-delimited ASCII format > Options with q2cda and qvq2cda
 
Options with q2cda and qvq2cda
Options enable you to control more precisely the type of output you create. Some parameters are followed by a character or filename. Spaces between the key letter and the character or filename are optional.
Options
–a string
Insert the given character or string after each entry. The default is the double quote. Use this option together with the –b option if you want non-numeric items to be enclosed in something other than double quotes.
–b string
Insert the given character or string before each entry. The default is the double quote. Use this option together with the –a option if you want non-numeric items to be enclosed in something other than double quotes.
–d char
Use the given character as the delimiter between items. The default is a comma.
–h
Treat column headings in g statements as separate blocks of text, one per column, rather than as a single block of text converting all columns.
If you want this type of layout, you must include a g statement with underlining using = or – signs, and the underlining must extend the full width of the longest text in each column since it is this which q2cda and qvq2cda use to determine the column widths and the positions of the column breaks.
q2cda and qvq2cda check each table to see whether the column headings are defined with g statements. If they are, it then looks at the last g statement in the block to see whether it defines underlining with = or – signs and, if so, breaks all texts in the block wherever it finds a space in the underlining. If the column headings are not defined on g statements or there are g statements but the last one does not contain underlining, q2cda and qvq2cda place all the column texts in a single block as it would without this option.
–ifilename
The name of the input file.
–ofilename
The name of the file in which to place the output.
–p
Print percent signs after the percentage values.
–S string
Replace asterisks with the given string or character. Neither q2cda nor qvq2cda prints asterisks at all and normally replaces them with zeros. The program issues a message for each asterisk found confirming that it’s been replaced with the given string or character.
–s string
Insert the given string or character in the first cell of the second and subsequent lines of an entry consisting of more than one line. The default is to leave that cell blank (that is, two consecutive double quotes).
Multi-line entries generally occur when the table consists of more than one type of figure for each row. For example, if the table contains absolutes and column percentages, the absolutes are the first row and have the row text in the first cell, while the column percentages are the second line and have a blank first cell. With this option you could replace this blank cell with a special continuation character such as @.
This option also applies to the blank cell at the start of the column headings line.
–t
Do not print table titles. The only texts are the column and row headings.
–x
Print a reminder of the syntax and options available.
Example
This statement:
qout -p | q2cda –p –d~–b^ –a$ –s@ –osample.out
creates a file called sample.out in which percentages are followed by percent signs, items are separated by tildes, texts are preceded by carets and followed by dollar signs, and continuation lines have @ in the first cell.
Here is sample.out:
^London Shopping Survey$
^#page$
^Absolutes/col percents$
^$
^$
^$~^Base            Male         Female$
^Base$~173~34~139
^North$~59~10~49
^@$~34.1%~29.4%~35.3%
^South$~49~11~38
^@$~28.3%~32.4%~27.3%
^East$~3~6~24
^@$~1.7%~17.6%~17.3%
^West$~35~7~28
^@$~20.2%~20.6%~20.1%
Here is an example of using –h to treat each column heading as a separate block of text. The default is to treat each line of column headings as a single block of text:
"                         Tho-        Buy        "
"             Some- Knew  ught        1 Or  Buy  "
"       Bght. one    It    It   First Less  2 - 4"
"       Issue Else  Was   Was   Issue  Out  Out  "
"       My-   Bght. Extra Reg.  Ever  Of 4  Of 4 "
" Total Self  Issue Issue Issue Bght. Issue Issue"
" ===== ===== ===== ===== ===== ===== ===== ====="
If you include –h, q2cda and qvq2cda will treat each column heading as a separate text. The column headings shown above would become:
"      ","      ","      ","      "," Tho- ","      "," Buy  ","      "
"      ","      "," Some-"," Knew "," ught ","      "," 1 Or "," Buy  "
"      "," Bght."," one  ","  It  ","  It  "," First"," Less "," 2 - 4"
"      "," Issue"," Else "," Was  "," Was  "," Issue","  Out "," Out  "
"      "," My-  "," Bght."," Extra"," Reg. "," Ever "," Of 4 "," Of 4 "
" Total"," Self "," Issue"," Issue"," Issue"," Bght."," Issue"," Issue"
" ====="," ====="," ====="," ====="," ====="," ====="," ====="," ====="
The layout above shows the column headings enclosed in double quotes separated by commas. These are the defaults. If you define other characters using options on the command line, q2cda and qvq2cda will use those characters instead.
See also
Convert tables into comma-delimited ASCII format