Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Best way to read an Excel spreadsheet into SAS to use for analysis

Posted on 2013-06-10
1
Medium Priority
?
501 Views
Last Modified: 2013-06-11
I have an Excel spreadsheet with 0's and 1's as answers to questions.   The spreadsheet is in colum format i.e.:

01a,  01b, 01c, 01d, 01e  respectively for possible answers to question1.

Wht is the most efficient way to read this data in for analysis
0
Comment
Question by:morinia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 8

Accepted Solution

by:
ShannonEE earned 2000 total points
ID: 39236532
Hi there morinia,

If you have access to SAS Enterprise Guide then,

First go into excel and make sure that each column has a name in row 1, that is for your case insert a row above row 01 and then put in names that satisfy SAS criteria for variable names.  While it is possible to have names with blanks and special characters, my suggestion is to choose the alphanumeric names that are going to mean the most to you rather than letting SAS give you its version.
Next make sure that there is no stray information after the last data column and after the last data row.
Give the spreadsheet a useful sheet name and delete all other sheets (even if they don't have any data.

Save the excel file - this will become step 1 in your project.

Next go into Enterprise guide and just import the file - this is straight forward, just make sure that you put the file into a permanent library.  (File -> import data ...).

-------

If you have access to SAS AMO (add in to ms office) then,

open excel
select all the data you want to import,
and select SAS from the menu bar (SAS gets added when you set up the AMO).
The data will be transmitted to SAS for processing.

-------

If you don't have access to Enterprise guide or AMO then, -

Go into excel,
delete all extraneous data  
       delete rows above the start of data (if any)
       delete rows below the end of data
       delete columns to the left and to the right of data

File -> save as
       Under "save as type" select
               Formatted text (space delimited) (*.prn)
       Add a file name  (in this example c:\data\yourSavedFile.prn)
click Save

then in SAS

filename  excel "c:\data\yourSavedFile.prn";
data <libraryName>.spreadsheetData;

     infile excel;
     input name1 name2 name3 ....   nameN;

run;

Open in new window


where you specify a library if you want the data to be permanent.

If there is a large number of variables then you may need options for the record length on the infile statement.

There are other methods, the method above is reasonably simple and should work almost everywhere.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
Lotus Notes has been used since a very long time as an e-mail client and is very popular because of it's unmatched security. In this article we are going to learn about  RRV Bucket corruption and understand various methods to Fix "RRV Bucket Corrupt…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question