In general when you have files from Excel, SPSS or other programs the program ‘StatTransfer’, can be used for any data file to a SAS data set. Alternatively, most programs will allow you to print data in a text file. This file can then be read into SAS using the previously described methods. Here we describe how to use the SAS procedure PROC IMPORT. This procedure works by generating SAS syntax that reads in data using the methdodology described in the first part.

Reading in data using PROC IMPORT

In the second part we describe how to use the SAS procedure PROC IMPORT. This procedure works by generating SAS syntax that reads in data using the methdodology described in the first part

Example A data set with information about Health related Quality of Life from a clinical trial. Data stored in an Excel sheet

PROC IMPORT OUT=work.SCQoL
            DATAFILE='C:\proj\HRQoL\validering\SkinCancer.xlsx'
            DBMS=XLSX
            REPLACE;
RUN;

Notice DBMS=, also works with DBMS=XLS for older excel files

Example a data set in SPSS format with quastionnaire data

PROC IMPORT
  DATAFILE='C:\old\DATAFILES\questionnaire\data.sav'
  OUT=WORK.NEW
  DBMS=SAV REPLACE;
RUN;

An SPSS data set has the file extension SAV so we use this in the DBMS statement.

Files from external programs can be imported using ‘Import Wizard’. open the File menu and select ‘Import Data’ to enter the Import Wizard

Screenshots


Remember