Quantum
Quantum
Edit section – Validate data, corrects data, create lists and reports, produce new data files, recodes
data and creates new variables
Write – The records are written to the default print file, out2
Ed
Edit statements
End
Continuation –
if (c132’12’.and.t5.gt.50)
+else
+write ofil
if (c132’12’.and.
Data variables
Integer variables
Real variables
Datatype variable_name size(s) – (s) is used to avoid paranthesis while using index of variable array
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)
List
definelist fveg=(205:207,210,215,220)
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
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
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)
Record length To identify the max record length (default 100 columns)
reclen=n;
struct;read=0;reclen=200
struct;read=2;reclen=70
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)
Repeated card types To mention which cards are repeated in trailer cards data
Max=11
Merge data – To merge extra data from other file to main data file (Can merge up to 9 different files)
t1 = mergedata($manuf_codes$,c(178,180),15,c(168,175),1)
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
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
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 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)
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
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)
%5.2r 2 places for decimal values, 1 place for decimal point and remaining 2 places for whole
number
int films 5s
ed
If 1 is there in all 3 set of columns then it is counted as 3 and stored in films integer array
If - else
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’)
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
Above statement will not consider any other edit statements after this and return to tabulation
section
count c(101,116) $Visitor Survey - British Museum (Natural History) ALL VISITORS$
list c(101,102)
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)
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)
return
end
Options:
c- compiling
o- creates tables
Output options
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,
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
1 Absolutes
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)
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