Desktop User Guides > Professional > Data management scripting > Working with the Weight component > Weight component examples
 
Weight component examples
This section provides some mrScriptBasic examples that illustrate using the Weight component. The examples are designed to illustrate how to use the Weight component only. They are not meant to be an accurate representation of how you should use weighting in a survey.
The examples use copies of the UNICOM Intelligence Data File version of the Museum sample that is installed with the UNICOM Intelligence Developer Documentation Library. The Museum sample metadata file is called museum.mdd and by default it is in the [INSTALL_FOLDER]\IBM\SPSS\DataCollection\<version>\DDL\Data\Data Collection File\ folder. If the sample files are in a different location on your computer, you must edit the Weight1a.mrs script before running it. To avoid updating the original Museum sample files, Weight1a.mrs makes copies of the original files, and the remaining scripts then add weights to the copies.
The topics in this section use tables created using UNICOM Intelligence Reporter to show the data when it has been weighted using the weighting. However, UNICOM Intelligence Reporter is not a requirement for using the Weight component. If you do not have UNICOM Intelligence Reporter installed, you can create equivalent tables using SQL queries in DM Query. For more information, see 7. Learning about weighting and Advanced SQL queries.
Here is a table of age by gender run on the unweighted Museum data, to which you might want to refer for comparison purposes.
This graphic is described in the surrounding text.
Each of the mrScriptBasic examples shown in this section is available as a sample .mrs file that is installed with the UNICOM Intelligence Developer Documentation Library. The samples are called Weight1a.mrs, Weight1b.mrs, Weight2.mrs, Weight3.mrs, Weight4.mrs, and Weight5.mrs. In addition, there is a combined sample, Weight_FullExample.mrs, that can be used as the basis for a simple production weighting script. For more information, see Sample mrScriptBasic files.
Running the mrScriptBasic examples
You can run the mrScriptBasic (.mrs) examples in UNICOM Intelligence Professional or using the mrScript Command Line Runner.
Before you run the examples, check that any filenames, and file and folder locations that are referred to in the examples are correct for your system, and if necessary edit the examples accordingly.
Running the mrScriptBasic samples in Professional
1 Open UNICOM Intelligence Professional.
2 Open the .mrs file you want to run. (The sample mrScriptBasic files are typically installed into the [INSTALL_FOLDER]\IBM\SPSS\DataCollection\7\DDL\Scripts\General\mrScriptBasic folder.)
3 Press F5 or choose Start from the Debug menu OR select the Start tool on the Debugging toolbar.
If the examples are not successful, check the value of the ErrorText variable in the Locals pane.
For more information on editing, running, and debugging mrScriptBasic files in UNICOM Intelligence Professional, see Using UNICOM Intelligence Professional.
Running the mrScriptBasic samples using the mrScript Command Line Runner
1 Open a Command Prompt. For example, in Windows choose Programs from the Windows Start menu, and then choose Accessories, followed by Command Prompt.
2 Change to the folder in which the sample files are located. This is typically the [INSTALL_FOLDER]\IBM\SPSS\DataCollection\7\DDL\Scripts\General\mrScriptBasic folder.
3 Type mrScriptCL followed by the name of the file you want to run and the options you require. It is recommended that you use the /v option. For example, to run the Weight1a.mrs sample, enter:
mrScriptCl Weight1a.mrs /v
Using the /v option means that the mrScript Command Line Runner displays the variables used in the script and their values when the script exits. This means you can check the value of the ErrorText variable if there are any errors.
For more information, see mrScript Command Line Runner.
Requirements
UNICOM Intelligence Professional
See
Editing the default data source information in the Museum.mdd file
Creating a new variable to hold the weighting information
Simple target weighting example
More on target weighting
Factor weighting example
Rim weighting example
Setting up weighting in a DMS file
Working with the Weight component