0% found this document useful (0 votes)
41 views9 pages

Quantum

The document describes the key components and functionality of the Quantum statistical software: 1. Quantum has two main sections - the edit section for data validation/preparation and the tabulation section for producing tables and statistics. 2. A typical Quantum program includes statements for the edit section, included tabulation tables, and output formatting options. 3. The edit section allows for validating and transforming data through commands like if/else, field, merge, and calling subroutines. Records can be rejected or sent directly to tabulation. 4. The tabulation section produces tables and statistics using included statements specifying the variables and formatting. Output can be customized through options like column width sorting.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views9 pages

Quantum

The document describes the key components and functionality of the Quantum statistical software: 1. Quantum has two main sections - the edit section for data validation/preparation and the tabulation section for producing tables and statistics. 2. A typical Quantum program includes statements for the edit section, included tabulation tables, and output formatting options. 3. The edit section allows for validating and transforming data through commands like if/else, field, merge, and calling subroutines. Records can be rejected or sent directly to tabulation. 4. The tabulation section produces tables and statistics using included statements specifying the variables and formatting. Output can be customized through options like column width sorting.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Two sections – Edit and tabulation sections

Edit section – Validate data, corrects data, create lists and reports, produce new data files, recodes
data and creates new variables

Tabulation section – Produces tables and performs statistical calculations

A typical program looks like

*include edit – Edit section

a;dsp;decp=0;spechar=-*;flush – Characteristics that applicable for all tables

*include tabs – contains information of all tables to include in report

*include axes – contains syntax of all tables created

Write – The records are written to the default print file, out2

Goto – goto another edit statement

Return – send the record straight to the tabulation section

Ed

Edit statements

End

Comments – Comments can start with C in column1 or /* in first two columns

Continuation –

+  splitting between keywords

if (c132’12’.and.t5.gt.50) write $t5 incorrect$; else; write ofil

if (c132’12’.and.t5.gt.50)

+write $t5 incorrect$

+else

+write ofil

++  continuation of long statement over several lines

if (c132’12’.and.

++t5.gt.50) write $t5 incorrect$; else; write ofil


The statement nocheck_ causes possible syntax errors to be flagged but ignored, and this is the
default. Opposite is check_

Data variables

Integer variables

Real variables

Datatype variable_name size(s) – (s) is used to avoid paranthesis while using index of variable array

Data var1 10s

Int var1 10s

Real var1 10s

Quantum provides 200 integer T variables and 100 real X variables.

All integer and real variables will have 0 or 0.0 value at the starting of Quantum run and will not
reset between the respondents. So if needed need to assign 0 value at the starting of edit section.

To read real numbers data - cx(15,20), contains decimal point as well and no need to mention
where it is.

rangeb(start,end,min,max)

A variation of range is rangeb which allows columns to the left of the field to be blank if the
number is right-justified in the field. In all other respects it is exactly the same as range.

rangeb(17,18,1,10)

start – start column -17

end – end column – 18

min and max are range delimiters (1, 10)

List

variable-name .in. (list) or

arithmetic-exp .in. (list)

contain up to 247 values or codes

c(145,147) .in. ($205$,$206$,$207$,$210$,$215$,$220$)

c(145,147) .in. (205:207,210,215,220)


Name lists

definelist fveg=(205:207,210,215,220)

c(145,147) .in. fveg

Types of record – 3 types

1. Ordinary records (single card records)- These are strings of codes and numbers, one per
respondent, up to a maximum of 32,767 characters per respondent

2. Multicard records – Each respondent will have data in multiple lines identified by serial number
and cardtype. This two information should be in the same positions for all cards of each respondent
and for all respondents.

Each card will have max 80 columns and occasionally 100 columns

327 cards per respondent – max limit

3. Multicard records with trailer cards – Similar type of information is recorded and stored in same
type of card. Always demographic information should be in higher cards. Eg: are questions for each
store visited, children information, travel information

Structure of the record

Struct; read=n;reclen=n;ser=c(m,n);crd=cn;req=card_numbers;rep=card_numbers;max=n

Record type  To mention which type of data file (default consider as ordinary)

Read=n; 0 – ordinary, 2 – multi cards, 3 trailer cards

Record length  To identify the max record length (default 100 columns)

reclen=n;

struct;read=0;reclen=200

struct;read=2;reclen=70

Serial number  Define the location of serial number of a record

struct;read=0;ser=c(1,5)

struct;read=2;ser=c(1,5)

Card type location  Define the location of card type. This is for multi card records only

struct;read=2;ser=c(1,4);crd=c5

Required card types  To mention which cards are mandatory in the record (only for multi cards)

Req=1,2,3,4 or req=1/4 or req=1:4

Repeated card types  To mention which cards are repeated in trailer cards data

rep=1,2,3,4 or rep=1/4 or rep=1:4


Highest card type number  This needs to mention if the card type is more than 9. Max value can
set is 327. (Ordinary record length is 32767)

Max=11

Merge data – To merge extra data from other file to main data file (Can merge up to 9 different files)

int_variable=mergedata($ex_file$, key_field, key_start, copy_to, data_start)

t1 = mergedata($manuf_codes$,c(178,180),15,c(168,175),1)

ex_file – External data file name

key_field – Main data file columns having matching unique key

key_start – starting column of external data file which has the matching unique key of main data file

copy_to – set of columns where the extra data to be copied into main data file

data_start – starting column of external data file from which the data needs to be copied

int_variable returns 1 if key is matched otherwise returns 0

Write – write statement writes the data in default print file out2 with column numbers as rulers and
the message used in write statement

Write $check$

If the file need to written in any other file need to use the name of the file after write statement and
it should be defined using filedef before using it

Write pfile $First file$ -> pfile is the file name

Filedef pfile data - > defining the data file

filedef filename[=pathname] report [len=rec_len]

filedef filename[=pathname] data [len=rec_len]

filedef filename[=pathname] print [mpa][mpd][mpe][len=n][norule][noser][$text$]

Report – To write information of C array to a report file

Report filename parameters – Add all records data in the same line

Reportn filename parameters – Each record data will be added in a new line

Report pfile c31, c35, c40 -> Consider blanks and multicodes as astrick (*)

Report pfile c(31,40) -> Ignores blanks and multicodes

Report pfile c31:10 -> Consider blanks and multicodes as astrick (*)
Report pfile c(31,40):10-> Ignores blanks and multicodes; Data right justified and left columns will be
blank if no data (Refer page 87 of volume 1)

To write information of integer and real variable to a report file

report rfile codenums:5 (5 is field width)

If field width not there, data is left justified otherwise it is right justified padded with blanks

report rfil cost:6.2 (6 is field width and 2 is decimal places); If the parameters are not mentioned
prints value with starting position and with 6 decimal places

Writing out data in user defined format

The write statement lets you write data out to a print file, including the standard print file (usually
called out2), but it always writes the data in a fixed format that you cannot change. The report
statement lets you write out data and text in any format you like, but only to a report file. You
cannot write to a print file with report. The qfprnt function brings together the functionality of write
and report by writing text and data to the standard print file in a format of your choice. To use it,
type: call qfprnt(0, $format$, variables)

call qfprnt(0,$Number of products tested is: %2i$,t1)

call qfprnt(0,$Number of products tested is: %2i$,t1)

%2i  2 places of integer variable

call qfprnt(0,$%5.2r liters bought$,liters)

15.27 liters bought

%5.2r  2 places for decimal values, 1 place for decimal point and remaining 2 places for whole
number

call qfprnt(0,$Record %4c tested %2i products$,c1,t1)

Record 1234 tested 5 products

%4c  4 columns from specified column

Multicodes will be converted to * or into letter like A for ‘&1’


Field – setup an array based on numeric data in the data

int films 5s

ed

field films = (c(12,13), c(14,15), c(16,17))

If 1 is there in all 3 set of columns then it is counted as 3 and stored in films integer array

field films = (c12, c14, c16) :2

field films = c12, c16 / c52, c56 :2

This reads c(12,13), c(14,15), c(16,17), c(52,53), c(54,55) and c(56,57)

field films = c23 / c36 / c71 :2

If - else

if (c76’4’) t3=1; delete c76’3’; else; t3=2; emit c77’2’

go to 10

10 continue

do 20 t5 = (125,130,140,145)

if (c(t5,t5+4).gt.3000) c(t5,t5+4)=$ $

20 continue

do 20 t5 = 125,145,5

do 15 t1 = 25,35,2 / 50,62,3

do 10 ’code’ = (’1’,’3’,’5’)

if (c110’code’ .or. c111’code’) emit c180’code’

10 continue
Rejecting records - To reject a record from the tables, but to include it in the rest of the edit

Jumping to tabulation section - To send the record to the tabulation section. Terminate the edit
section immediately and return to tabulation

The return keyword is often used with reject to reject a record without finishing the edit

if (c73’8’) reject; return

Above statement will not consider any other edit statements after this and return to tabulation
section

Hole count and listings

count c(101,116) $Visitor Survey - British Museum (Natural History) ALL VISITORS$

list c(101,102)

lista – sorts the data in alphabetical order (codes order)

listr – sorts the data in rank order (data of codes in ascending order)

Split - To write correct records out to a clean data file and incorrect records out to a dirty data file

Fetch subroutine

call fetch($file_name$,key_col,put_col) where file_name is the name of the look-up file, key_col is
the start column of the key in the record, and put_col is the start column of the field into which the
data is to be copied

First line will contain length of key and length of data to be copied (Refer pg 193 vol1)

Explode subroutine

call explode(mc_start_col,num_cols,’codes’,sc_start_col)

call explode (c132,2,’1/5’,c140)

Codes are exploded in the order 1234567890–&

Each existing code will be written in one column. If code not found column will remain blank
Own subroutines

ed

int items 1

call sub1(items)

return

subroutine sub1(items)

if (items.gt.5) emit c134’1’

return

end

Running quantum files

Quantum options program file data file tables file

Options:

c- compiling

k- keeps the intermediate files

o- creates tables

Output options

Colwid = n, csort, rsort, dec=n, decp=n, dsp,

flush (p:25) to align starting number of absolutes and decimals on same line,

hitch(p:27) to print table on previous page if space is there to print whole table,

indent = n (row space),

netsort – indentation of 2 spaces for each net level in table. Need to use with sort option. If need to
increase the indent spaces use netsort = n

nooverlapfoot – suppress statistical data on overlapping data

noprint – supresses printing of a table if all cells have blank data

notauto – supresses footnotes T-statistics applied to a table

notbl, nzcol, nzrow


op = n

1 Absolutes

2 Col percentage on current base

6 Col percentage on first base

0 Row percentage & Total percentage

8 Indices

–/3 Row or column ranks Absolutes for tables of means/proportions (Quantum only) Proportions
(Quanvert only) Means (Quanvert only) Statistical probabilities Statistical flags Percentage
differences

Page – page number; paglen=n (Length of page, default 60), pagwid=n (Width of page)

Pc (percentage sign), pcpos=+/-n (same as flush, to move forward and beyond use + or – number)

Pcsort – sorts table based on percentages

Printz – prints the table which has all zeros; by default, suppresses

Side = n To alter size of row text width; default 24, can increase to 120

Specchar = ab, replaces true zeros with a and rounded to zeros with b

Topc – prints % sign on top of each column works when nopc is used and op=2

Data options

Clevel – determines confidence level for all tests run

Dp = all values are calculated with double precision

Inc=arithmetic_expression – incrementing with the actual value of expression rather than 1

You might also like