The optional REPLACE statement says that if there is an existing dataset in SAS's memory with this name, it should be overwritten.Specifically, it tells SAS what engine to use to read the data (in this case, the EXCEL engine). The DBMS option tells SAS the type of data it is importing.The DATAFILE option points to the file directory of the dataset you are importing.The OUT option tells SAS where to put the new SAS dataset it is creating – in this case we told it to put the new SAS dataset “sample” in the Work library.This is because the syntax includes quite a few options associated with the PROC IMPORT statement: Note the first semicolon is not until the third line. It starts with a PROC IMPORT statement, which triggers the data import action. It should look like something similar to below.
Locate the directory that you told the Import Wizard to save your Editor file to, highlight the file and click Open. Make sure the Editor window is active, and then click File > Open Program or click in the toolbar. The Import Wizard saved an Editor file, but it did not open it or append it to an already open Editor file. This will open your data to view in SAS.įinally, we might want to take a look at the statements generated from the Import Wizard. Locate the dataset icon and double-click on it. In this case, the imported dataset is in the temporary Work library, so double-click on Work. In the Explorer window, double-click on Libraries to display the Libraries that are available in this session. You can view any of your SAS datasets by finding them in the Explorer window. You will also probably want to look at your data to make sure everything looks right. If there had been a problem with the import, a Warning or Error would have appeared instead. The Log window provides this Note statement that tells you your dataset was successfully created. If you look in the Log window you’ll see there was some action: Running the Import Wizard executes statements in SAS – it’s just behind the scenes a bit because the Wizard writes the statements for you – so then the Log window is the first place you should look. Remember the earlier tip to look at your Log window after you execute any statements in SAS. No data appears for you to see and enjoy no Editor file appears for you to manipulate and play with. The last step is to click Finish.Ĭlicking on the finish button was probably anticlimactic, because nothing seems to happen. You can type the file directory directly into the text box, or click on Browse to locate a folder to save the program in. This way you have the import steps saved, and you can go back and re-run it or modify it later if you need to. The last step allows you to save the statements that SAS generates while executing the Import Wizard into an Editor file.
NOTE: Choosing an existing dataset from the list will over-write that data the existing file in the library will be replaced with the file you are importing. You can type in a dataset name here, or choose a dataset from the list. The next dropdown menu, under Member, requires you to name the dataset. If you’ve already created a library with a LIBNAME statement, you can choose one of those instead. If you want it to be temporarily stored for now, choose WORK. The first drop-down menu is a list of available libraries that you can choose to store your newly imported SAS dataset in. This next step tells SAS where you want to store the newly imported dataset. The default is for all options to be checked, and that works for our purposes. Be sure and select the options that are correct for your dataset. In this example we will choose Sheet 1 since our data appears on Sheet 1 in the Excel file. SAS then asks you what sheet from the file you want to import. Once you’ve added the file path to the text box, click OK. You can either type the file directory into the text box, or click Browse and choose the file to import. Now you need to tell SAS where to find the file you want to import. Once you’ve chosen the data source, click Next. As you can see, SAS provides you with a large variety of data types to import. In our case, the dataset we want to import is an Excel file, so select Microsoft Excel Workbook. (The second option, specifying a file format, is not covered in this tutorial.) Click Standard data source and then choose the program that is the source of your data from the drop down menu. This first screen will ask you to choose the type of data you wish to import. Let’s import our sample data, which is located in an Excel spreadsheet, as an illustration of how the Import Wizard works.Ī new window will pop up, called "Import Wizard – Select import type". To start the Import Wizard, click File > Import Data.