# Frequently Asked Questions

Below are some frequently asked questions about the defineR package. Click on the links below to navigate to the full question and answer content.

## Index

- What is a define.xml?
- How do I generate a define.xml for ADaM?
- Where can I get a metadata template?
- Can I generate a define.xml for SEND?
- Can I use my XPT files to generate a metadata file?
- Can I use other files to generate a metadata file?
- Does the package support define 2.1?
- What if I want to use a different XSLT style sheet?
- Can it read in an existing define.xml?
- Is this the same template as the SAS® toolkit?

## Content

### What is a define.xml?

Q: I don’t quite understand what this is about. What is a define.xml? Do I need one?

A: The define.xml is a special XML file used to describe data sent to regulatory bodies for drug applications. If you don’t know what it is, then you don’t need one.

top

### How do I generate a define.xml for ADaM?

Q: The defineR generator seems to always create a define.xml for SDTM. I want to create one for ADaM. How can I do that?

A: There is a parameter called `type` on the `write_define()` function that you can use to specify an SDTM or ADaM define. Here is an example:

    # Get temporary directory for output
    tmp <- tempdir()

    # Create demo spreadsheet
    pth <- write_metadata(tmp, type = "adam", demo = TRUE)

    # Generate define for ADaM
    res <- write_define(pth, tmp, type = "adam")

    # View XML
    # file.show(file.path(tmp, "define.adam.xml"))

    # View check report
    # file.show(file.path(tmp, "check.adam.pdf"))

    # View HTML
    # file.show(file.path(tmp, "define.adam.html"))

top

### Where can I get a metadata template?

Q: I’d like to try out defineR. Where can I get a starting template?

A: You can generate a starting template. It it recommended to start with the demo template, rather than a blank template. To do that, set the `demo` option on the `write_metadata()` function. Like this:

    # Get temporary directory
    tmp <- tempdir()

    # Create metadata template
    write_metadata(tmp,
                   type = "<sdtm or adam>",
                   demo = TRUE)

top

### Can I generate a define.xml for SEND?

Q: I am working on an animal study, and need to generate a define.xml for SEND. Can defineR do that?

A: Not at this time. If you desire this feature, please submit a request to the GitHub issue list.

top

### Can I use my XPT files to generate a metadata file?

Q: I have some XPT files already. Can I use them to generate metadata?

A: Yes. Use the `write_metadata()` function, and supply the `src_dir` parameter with the directory that contains your XPT files. Like this:

    # Get temporary directory
    tmp <- tempdir()

    # Create metadata template
    write_metadata(tmp,
                   type = "<sdtm or adam>",
                   src_dir = "<source data path>")

top

### Can I use other files to generate a metadata file?

Q: What if I don’t have XPT files? Can I generate metadata from Excel files or SAS datasets?

A: Not in the current release. If you desire this feature, please submit a request to the GitHub issue list, and we can up the priority.

top

### Does the package support define 2.1?

Q: Our organization is getting ready for define version 2.1. Does the defineR package support it?

A: Not yet. Define version 2.1 will be coming in a future release.

top

### What if I want to use a different XSLT style sheet?

Q: I have a custom style sheet, and want to use it with defineR. Can I do that?

A: Yes. There is a global option to specify a custom style sheet. The option is called “defineR.xslt”, and you can set it as follows:

    options("defineR.xslt" = "<path>")

top

### Can it read in an existing define.xml?

Q: I have a define.xml alread and want to create a metadata template from it. Can this package do it?

A: Not at this time. If there is sufficient interest in this feature, we can add it.

top

### Is this the same template as the SAS® toolkit?

Q: This template looks exactly like the template in the SAS® Clinical Standards Toolkit. Are they the same?

A: Yes. The metadata template for the defineR package was taken directly from the SAS® template. This was done for ease of interchange/migration between the two systems.

top