Help using Base SAS procedures

Using data from excel- Help please??

Reply
New Contributor trb
New Contributor
Posts: 3

Using data from excel- Help please??

I am a student and new to SAS. I have a pretty large dataset in Excel and I am trying to duplicate some analyses my advisor ran after typing her dataset right into excel.

This is how I imported my data from Excel:
PROC IMPORT OUT= WORK.dissertation
DATAFILE = "C:\Documents and Settings\Me\My Documents\dissertation.xls"
DBMS=EXCEL REPLACE; stopover;
SHEET="Sheet1;
GETNAMES=YES;
MIXED=NO;
SCANTEXT=YES;
USEDATE=YES;
SCANTIME=YES;


This is her data statements that she ran before doing ANOVAS:
DATA rate0 ;
INFILE 'H:\Data\ms-ratings-dats.TXT'' ;
INPUT var1 1-3 var2 5 var3 7-8 var4 10-12 var5 14 var6 16 var7 18 var8 20;


From there, it looks like she sets the value of some of the variables and then runs the ANOVA.

Is there a comparable INFILE statement I should be running with my Excel data that would make my data ready for analysis?



eta: when I just replace the TXT file name with my excel file, I get errors; it reads none of the variables. Message was edited by: trb
Super User
Posts: 19,817

Re: Using data from excel- Help please??

That infile statement is reading a data set from a text file.

If you're trying to use the data you imported instead of the text file, use the line
set dissertation;

instead of the infile and input lines. You'll probably have to rename variables as well.

I'll also mention I haven't seen a stopover option before in proc import...I'll have to google that one.

You might want to review some sas basics before playing around with this stuff though. I highly recommend the SAS UCLA tutorials online for beginners.
New Contributor trb
New Contributor
Posts: 3

Re: Using data from excel- Help please??

Thank you! I was able to run my ANOVAS with your help. And thanks for referring me to the user-friendly tutorials!
New Contributor trb
New Contributor
Posts: 3

Re: Using data from excel- Help please??

Thank you! I was able to run my ANOVAS with your help. And thanks for referring me to the user-friendly tutorials!
Occasional Contributor
Posts: 14

Re: Using data from excel- Help please??

you can save your Excel file in csv format, then use the INFILE.
Ask a Question
Discussion stats
  • 4 replies
  • 177 views
  • 0 likes
  • 3 in conversation