?
Solved

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

Posted on 2013-06-10
1
Medium Priority
?
491 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Recently I was talking with Tim Sharp, one of my colleagues from our Technical Account Manager team about MongoDB’s scalability. While doing some quick training with some of the Percona team, Tim brought something to my attention...
In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
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…

770 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