# Adding a cat Statement to the Data Function

A `cat` or a `print` statement is useful for understanding your code's behavior. For example, you can use it to check the success of a condition, or to make a note in the output at a specific time when the code is running.

## About this task

This example builds on the data function created in the example Debugging a Simple Data Function. You can add a `cat` statement to any data function.

## Before you begin

- You must have the advanced analytics license to use the TERR toolset. If you do not have this license, see your Spotfire administrator.
- You must have Enabling Debugging for Data Functions.
- You must have completed the example Debugging a Simple Data Function, or you must have your own data function that you want to debug.

## Procedure

1. On the Spotfire Analyst menu, click Edit > Data Function Properties, and then in the Data Function Properties dialog box, click Edit Script to return to the data function script.
2. Add a `cat` statement to the script.
   If you are working through the example, add the `for` loop, shown below, and then save and close the script.

       # For the example, insert a script that simply prints an iteration.
       for (i in 1:10) {
         cat("iteration", i, "\n")
       }
       # The existing data function example
       x <- y

3. Click Refresh, and then close the dialog box.
4. Open the Notifications dialog box and review the debugging output.
   You should see the iteration in the debug output.
5. Close the Notifications dialog box.

## What to do next

Try exporting the data function results to view in RStudio.