New functionality in SELECT Command

 

An alternate form of the Select command may be used to randomly select a specified number of records from the data file. The syntax is:

 

SELECT  <Number of records>  /R

 

For example, the following command would randomly select 30 records from the data file and write a new codebook and data file called RND:

 

SELECT 30  /R

WRITE RND

..

 

Do not use the SAVE command in the same procedure as the SELECT command. Doing so would erase the original data file and replace it with a data file containing the selected records (resulting in a loss of data). Instead, use the WRITE command to create a new data file that contains just the selected records.

 

Each time a procedure with the SELECT command and the /R option is run, a new set of random records will be selected. Running the above procedure multiple times would change the contents of the RND data file each time. This can be altered by setting an explicit random number seed.

 

In the System Defaults File (StatPac.ini), the default for the RandomNumberSeed parameter is blank and will be shown as:

 

RandomNumberSeed = 

 

A blank random number seed means that a new set of random numbers will be created each time the random number generator is evoked. If you change RandomNumberSeed  to any numeric value, StatPac will use the same random number sequence each time it’s run. The number itself determines the random sequence  (which you cannot control), so it really doesn’t matter what number you enter, although different numbers will produce different random number sequences. A given number will always produce the same sequence.

 

RandomNumberSeed = 25

 

 

New method to comment sections of a procedure file

 

Writing complex procedures is often an iterative process. You’ll try something, see if it works, and then modify it. Try it again, and modify it… and so on until you get the result you’re looking for. Often times, you’ll want to save what you’ve written, and then try something new.

 

One way to do this is to insert an apostrophe at the beginning of each line you wanted to make a comment because lines beginning with an apostrophe are ignored when processing a procedure file. If you had a procedure file with 3 procedures, and you wanted to completely ignore procedure 2, you’d insert an apostrophe at the beginning of each line in procedure 2, like this:

 

Freq V1

..

‘ Title (#)

‘ Desc V2

‘ ..

Title (#)

Banners V2 By Total V1

..

 

A new method has been added to turn entire blocks of a procedure file into comment lines.

 

You can insert lines beginning with /* or ** to start a comment block, and */ or ** to end a comment block.

 

Using the new method, you could do the same thing using either of the following:

 

Method 1 – Begin a line with /* to start a comment block and */ to end a comment block

 

Freq V1

..

/*  Begin ignoring lines from here on

Title (#)

Desc V2

..

*/  Stop ignoring lines

Title (#)

Banners V2 By Total V1

..

 

Method 2 – Begin a line with ** to start and end a comment block

 

Freq V1

..

******** Begin a comment section *******

Title (#)

Desc V2

******** End a comment section *******

..

Title (#)

Banners V2 By Total V1

..

 

You can include as many procedures as you want in the comment section. All lines within the comment block will be ignored while processing a procedure file.

 

If you use the ** syntax to start and end comment blocks, then be careful because they work in pairs. If you have a start and stop comment and you remove the start comment ** while inadvertently forgetting to remove the stop comment **, then the stop comment ** would act like a start comment **.