Solved

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

Posted on 2013-06-10
1
480 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 500 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
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…

705 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