I have been trying to run the following code to import an excel data set.
libname fin617 '/folders/myshortcuts/fin617';
data fin617.week1and2;
set import;
run;
I return the following log with this error and warnings:
You might be better off using an IMPORT statement.
%let fin617 = /folders/myshortcuts/fin617/;
proc import datafile = "&fin617.week1and2.xlsx"
out=import
replace
dbms=xlsx;
run;
This is assuming your file is named week1and2.xlsx (case sensitive).
The SET statement corresponds to your input data; the DATA statement is your output data. It looks like you had those unknowingly mixed up.
Try this:
libname fin617 '/folders/myshortcuts/fin617';
data import;
set fin617.week1and2;
run;
The code you originally had was attempting to create the dataset fin617.week1and2 using WORK.IMPORT (which does not exist), instead of what it sounds like you intended: creating WORK.IMPORT using fin617.week1and2.
Thank you for the response. This time it ran successfully with no errors, however, the majority of the data from the excel did not carry over.
@nmlynar13 wrote:
... however, the majority of the data from the excel did not carry over.
What do you mean? Did some but not all of the data come into WORK.IMPORT?
Is WEEK1AND2 an Excel file or a SAS dataset?
Yes exactly. The excel file "week1and2" has about 36 columns for 640 rows. This produced 2 columns and 0 rows in SAS.
You might be better off using an IMPORT statement.
%let fin617 = /folders/myshortcuts/fin617/;
proc import datafile = "&fin617.week1and2.xlsx"
out=import
replace
dbms=xlsx;
run;
This is assuming your file is named week1and2.xlsx (case sensitive).
You are trying to use a dataset IMPORT in library WORK which is not there.
Keep in mind that WORK is a temporary library which is deleted (with all its content) when a SAS session terminates.
So if you have another code that is supposed to create IMPORT, run it first.
I'm not entirely sure how to create an import. I am entirely new to coding all together, not just SAS. This code was given to me through a professor with step by step instructions on how to reproduce what he had create. Intended to show us the basics of SAS, however, I continually get this error message and am unsure what steps to take. Unfortunately when I reached out to him for help, he did not answer.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.