Data editing > Flow control > Going temporarily to the tab section
 
Going temporarily to the tab section
Quick reference
To send a record temporarily to the tab section, type:
process
The record is returned to the statement immediately after process.
More information
The process statement is similar to return. When return is executed, the record is sent on to the tabulation section; after the tables are completed for that record, the program returns to the start of the edit section and the next record is read in.
When process is executed, the record is also sent immediately to the tabulation section where it is used in table creation. However, after the record has been tabulated, control passes back to the edit section to the statement immediately following the word process. The record continues through the edit and any statements after process applicable to the record are executed. At the end of the edit the record is passed through the tabulation section again.
The process statement is used when you need to tabulate portions of a record more than once. For example, if a survey asks shoppers about the brands of bread they purchased the last four times they visited the shops, the data can be set out as follows:
c134 : Brand purchased first time ('1'=Brand A; '2'=Brand B; '3'=Brand C; '4'=Brand D)
c135 : Number of loaves purchased at that time
c136 : Brand purchased second time
c137 : Number purchased second time
c138 : Brand purchased third time
c139 : Number purchased third time
c140 : Brand purchased fourth time
c141 : Number purchased that time
To create a table showing the total number of loaves of each brand bought by all (or selected groups of) respondents during their four trips to the store, set up an axis of the form:
l brd;inc=c135
n23Number of Loaves Bought
col 134;Brand A;Brand B;Brand C;Brand D
in the tabulation section, and then write the statement:
process
in the edit at the point you want to tabulate the record for the first brand.
The next set of edit statements is:
c(134,135)=c(136,137)
process
This overwrites the information about the first purchase with information about the second purchase, and the record is processed a second time. The total number of loaves bought on the second trip is added to the total number of loaves bought on the first trip.
The statements continue:
c(134,135)=c(138,139)
process
c(134,135)=c(140,141)
process
When you finish, the total number of loaves of each brand bought by all respondents during those four visits are in the relevant cells of the axis.
In a situation like this, you would probably put the process statements in a loop at the end of the edit, although this is not strictly necessary. For example:
do 10 t1 = 134,140,2
c(134,135)=c(t1,t1+1)
process
10 continue
This performs exactly the same task as the list of statements shown earlier; it is just a more efficient way of writing them.
Note Be careful if process is the last statement in your edit: the record is passed to the tabulation section by process and then again by the end statement. If this is not what you want, omit the last process.
For another example of process, see Incrementing tables more than once per respondent.
See also
Flow control