GetMRData Excel macro
The GetMRData macro provides an example of a VBA macro that accesses the metadata using the Metadata Model (MDM) and the case data using ADO.
By default, the macro is installed as an Excel file in:
[INSTALL_FOLDER]\IBM\SPSS\DataCollection\7\DDL\Code\General\Excel
The macro imports into Excel data that is stored any format for which a read-enabled DSC is available. (For information about which DSCs are available, see
Available DSCs.)
Using the macro to import data
These steps describe using the macro to import data that is stored in a SQL Server database in the standard UNICOM Intelligence Data Model format, such as data collected using UNICOM Intelligence Interviewer. However, you can also use the macro to import data from any format for which a read-enabled DSC is available.
1 Open the GetMRData.xls file in Excel.
2 From the Excel menu, choose Developer > Macros.
3 Make sure that the GetData macro is selected and then click Run.
This opens the Connection tab in the Data Link Properties dialog box.
4 From the Metadata Type list, select UNICOM Intelligence Metadata Document.
5 Enter the Metadata Location, by clicking Browse and browsing to the folder in which the questionnaire definition (.mdd) file is located.
6 You can optionally click the Properties button to select the Version, Language, Context, and Label Type you want to display. Then click OK to return to the Connection tab.
7 From the Case Data Type list, select UNICOM Intelligence Database (MS SQL Server) (read-write).
8 Generally, the
Case Data Location defaults to the connection string defined in the .
mdd file when the project was activated and you do not need to change it. However, if necessary you can enter the connection string manually. For more information, see
Connecting to a relational MR database using RDB DSC 2.
9 If necessary enter your Login ID and Password and click OK.
10 Enter the Case Data Project.
11 Click the Advanced tab, and from the Categorical Variables list, select Return data as category names.
This makes the macro display category names rather than numeric category values, which makes the data easier to understand.
12 Click OK.
The macro now imports the data into Excel.
Notes
▪UNICOM Intelligence 32-bit applications will only function properly with the 32-bit version of Microsoft Office; the UNICOM Intelligence 64-bit applications will only function properly with the 64-bit version of Microsoft Office.
▪In some versions of Excel, you need to set the macro security settings to medium or low before you can run the macro. To change the macro security settings, select Options from the Tools menu. This opens the Options dialog box. Select the Security tab, click Macro Security, and then select the macro setting you require, such as Medium. Click OK twice to return to the Excel window. You may now need to close and reopen Excel before you can run the macro.
Requirements
▪UNICOM Intelligence Data Model
▪Microsoft Excel
See also