how to import an excel file using the sas import wizard sas 9 for windows

17
How to Import an Excel File Using the SAS Import Wizard SAS 9 for Windows

Upload: jaron-collman

Post on 02-Apr-2015

257 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: How to Import an Excel File Using the SAS Import Wizard SAS 9 for Windows

How to Import an Excel File

Using the SAS Import WizardSAS 9 for Windows

Page 2: How to Import an Excel File Using the SAS Import Wizard SAS 9 for Windows

Go to the File menu and select “Import Data”

Page 3: How to Import an Excel File Using the SAS Import Wizard SAS 9 for Windows

Choose the file type.

Note: Click on the arrow at right of file format box to get a list of file types. Select the appropriate file type, then click “Next”.

Page 4: How to Import an Excel File Using the SAS Import Wizard SAS 9 for Windows

In the Connect to MS Excel window, Browse … to the file name.

Browse to the folder where you saved the Excel files.

Page 5: How to Import an Excel File Using the SAS Import Wizard SAS 9 for Windows

Locate and select the filename, in this example, “group1.xls”

Note: You will see a list of files to select. If you have selected the file type as Excel, you will only see files that have the filename extension “.xls” .After selecting group1.xls, click on “Open”.

Page 6: How to Import an Excel File Using the SAS Import Wizard SAS 9 for Windows

Click on “OK” to select the file.

Verify your file selection by clicking on “OK”.

Page 7: How to Import an Excel File Using the SAS Import Wizard SAS 9 for Windows

Select the correct sheet from the list.

The arrow at the right provides a pull-down list of available sheets. Select the correct sheet, and then click on “Next>”.

Page 8: How to Import an Excel File Using the SAS Import Wizard SAS 9 for Windows

Save the data set and click on “Finish” or “Next”.

The library selected may be WORK, or another library you have previously defined. Type the SAS data set name in the “Member:” box. Click on “Finish” to implement the import, or “Next” to save commands for importing. Use “Next” for homework 1.

Page 9: How to Import an Excel File Using the SAS Import Wizard SAS 9 for Windows

Create SAS statements to import the data.

If you selected “Next” you may now save SAS statements in a command file to use later. After specifying the file name, click “Finish”. For homework 1, you will save a command file called homework1.sas. Be sure you remember where you save the file, so you can pull it up later.

Page 10: How to Import an Excel File Using the SAS Import Wizard SAS 9 for Windows

Check the SAS log to be sure the data set was created

For homework 1, you should see a NOTE: that says “WORK.group1” was successfully created.

Page 11: How to Import an Excel File Using the SAS Import Wizard SAS 9 for Windows

From the Editor Window, Open the saved SAS statements

For homework 1, you would open homework1.sas from the Enhanced Program Editor window.

Page 12: How to Import an Excel File Using the SAS Import Wizard SAS 9 for Windows

Browse to the name of your saved commands

For homework 1, you would open the command file, homework1.sas, from the folder where you previously saved it.

Page 13: How to Import an Excel File Using the SAS Import Wizard SAS 9 for Windows

Modify the commands, so you can import group2.xls.

You will copy and paste the commands for each Excel file.

Page 14: How to Import an Excel File Using the SAS Import Wizard SAS 9 for Windows

Submit your commands..

In the Program Editor Window, highlight the commands to import the data for all of the 8 groups. Submit by clicking on the running figure icon.

Page 15: How to Import an Excel File Using the SAS Import Wizard SAS 9 for Windows

Check the Log Window to be sure all your data sets were properly created.

Page 16: How to Import an Excel File Using the SAS Import Wizard SAS 9 for Windows

Type a data step to combine data for all groups.

Highlight and submit the data step commands.Check the SAS log to make sure your commands worked properly.

Page 17: How to Import an Excel File Using the SAS Import Wizard SAS 9 for Windows

Submit commands for the rest of the homework. Type the commands for each procedure, submit them,

and check the results. Re-save your command file. The SAS commands in the Enhanced Program Editor

window can be copied and pasted into a Word document for your homework.

Output from the SAS output window can also be copied and pasted into a Word document for your homework.

You cannot edit the SAS output in SAS, but you can in Word.