BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
nmlynar13
Calcite | Level 5

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:

 

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
72
73 libname fin617 '/folders/myshortcuts/fin617';
NOTE: Libref FIN617 was successfully assigned as follows:
Engine: V9
Physical Name: /folders/myshortcuts/fin617
74
75 data fin617.week1and2;
76 set import;
ERROR: File WORK.IMPORT.DATA does not exist.
77 run;
 
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set FIN617.WEEK1AND2 may be incomplete. When this step was stopped there were 0 observations and 0 variables.
WARNING: Data set FIN617.WEEK1AND2 was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
real time 0.09 seconds
cpu time 0.02 seconds
 
 
78
79 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
91
 
I am not sure of how to fix this or even what this error means. I have tried restarting the SAS program, my computer, and double checking the file name.
1 ACCEPTED SOLUTION

Accepted Solutions
mklangley
Lapis Lazuli | Level 10

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).

View solution in original post

7 REPLIES 7
mklangley
Lapis Lazuli | Level 10

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.

nmlynar13
Calcite | Level 5

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.

mklangley
Lapis Lazuli | Level 10

@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?

nmlynar13
Calcite | Level 5

Yes exactly. The excel file  "week1and2" has about 36 columns for 640 rows. This produced 2 columns and 0 rows in SAS.

mklangley
Lapis Lazuli | Level 10

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).

Kurt_Bremser
Super User

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.

nmlynar13
Calcite | Level 5

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.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 7 replies
  • 6992 views
  • 0 likes
  • 3 in conversation