Export the data from Exercise 1b Result Session to a tab-delimited text file, including SAS code for reading in the new file.
- The Export menu can be used to export data displayed in a case listing or other matrix.
- The Results as Text File export option will export matrix results to a text file, with several formatting options available.
- Generate SAS Code to Read Data automatically creates an output (.sas) file containing the necessary SAS programming code to read in the data file created in the export.
Step 1: Open Case Listing 1b's Results
- Start SEER*Stat.
- From the File menu select Open > Case Listing File or use the on the toolbar.
- Open the matrix file you saved in Case Listing Exercise 1b. The filename should be "Case Listing Exercise 1b.slm".
- If you did not save the output for exercise 1b you may open our version of the output: Exercise 1b Session - Open our session and run, then save the matrix.
- Case listing examples are provided as session files instead of results matrices to ensure they may only be opened by those who have signed a SEER data use agreement and have permission to view individual records.
Step 2: Change Values Displayed to Unformatted
- Highlight all of the columns in the matrix. From the Edit > Highlight All menu, select Columns. You can also do this using Ctrl+A.
- Right click on any one of the selected column headers and select Display As > Unformatted. You can also do this using the Matrix > Display As menu.
Step 3: Select Export Options
- From the Matrix menu select Export > Results as Text File.
- A new window will be open displaying various available options for exporting text files.
- The top two selection boxes are used to specify the location of your exported data file and an accompanying data dictionary. These files are both required and have default values based on the current matrix, if it was saved. You can change the locations or names of these files by clicking the associated Browse buttons.
- Click the Generate SAS Code to Read Data checkbox to create a SAS program that will import and format the data. After enabling the SAS code creation, several default options will be checked below, which are generally recommended when creating a file for use with SAS. You can customize those options as appropriate for your programming needs. The file name and location of the SAS program will be based on the file name and location of the data file specified at the top. These can be modified if desired.
- If you do not have SAS, you can use this same export functionality to create a comma-delimited “.csv” file which can be read by other software tools. To do this, you need to change the extension of the data file name to “.csv” rather than “.txt”. Then select “Comma” as the field delimiter and check the box to “Output Variable Names Before Data.” – Use the CSV Defaults button.
Step 4: Export the Matrix Data and SAS Program
- Click OK to export the data as specified.
- After a successful export, three files will be created in the paths you specified.
- The “.txt” file is the exported data in a tab-delimited text file.
- The “.sas” file is the SAS code that can be used to read the data directly. This program includes the necessary file assignment, formats, input statement, formatting assignments and label assignments.
- The “.dic” the file is a computer-readable data dictionary describing the exported data – you will not need this file if you are importing directly into SAS.
- Compare your results to these files created based on the Exercise 1b Matrix File: key.case2.dic and key.case2.sas (SAS, 2 KB)
- Note that only the “.dic” and “.sas” files are included, as case data cannot be shared publicly.