BookmarkSubscribeRSS Feed
cetin
Calcite | Level 5

 

i created pg3 library then i want to import  datafile for this library but i take this note

 

NOTE: Import cancelled. Output dataset WORK.DENEME already exists. Specify REPLACE option to overwrite it.

 

can u explain this 

 

thanks for a lot

 

LIBNAME pg3 XLSX "/home/cetinkaygaldurak1/sasuser.v94/ULKE3.xlsx";

 

 

FILENAME REFFILE '/home/cetinkaygaldurak1/sasuser.v94/ULKE2_S.xlsx';

proc import datafile=REFFILE

            dbms=xlsx   

            out=pg3.deneme;

    sheet=ulke2_s;

run;

9 REPLIES 9
Tom
Super User Tom
Super User

This seems to be a question about PROC IMPORT.  Why did you use LIBNAME as the topic for the question?

 

From the error message you told PROC IMPORT to create a NEW data set named WORK.DENEME but and it already existed. If you want PROC IMPORT to remove the existing dataset then add the REPLACE option to the PROC IMPORT statement.

 

The same thing will apply to the SAS code you included if the dataset pg3.deneme (actually worksheet since you are pointing to an XLSX file) already exists.

cetin
Calcite | Level 5

hi tom;

you are right about subject;

 

you said that "NEW data set named WORK.DENEME" but i didnt use work i used pg3 library  pg3.deneme

 

so pg3 library dont have any data set  named deneme

thanks

 

 

 

Tom
Super User Tom
Super User

@cetin wrote:

hi tom;

you are right about subject;

 

you said that "NEW data set named WORK.DENEME" but i didnt use work i used pg3 library  pg3.deneme

 

so pg3 library dont have any data set  named deneme

thanks

 


I have never seen the SAS log report that it is using a different dataset than the code requested.   Remember that if you use a one level name, like DENEME, then it is assumed to be in the WORK library.

 

Please post the lines from the log (make sure to use the Insert Code icon in the editor menu so that lines don't get reflowed). 

cetin
Calcite | Level 5
LIBNAME pg3 XLSX "/home/cetinkaygaldurak1/sasuser.v94/ULKE3.xlsx";

FILENAME REFFILE '/home/cetinkaygaldurak1/sasuser.v94/ULKE2_S.xlsx';
proc import datafile=REFFILE
            dbms=xlsx    
            out=pg3.deneme;
    sheet=ulke2_s;
run;
Tom
Super User Tom
Super User
The lines in the SAS log will show line numbers before the lines of code and have messages from SAS like in your original post. That is just the same lines of code that you posted before. To tell PROC IMPORT it is ok to replace an existing dataset add the word REPLACE to the PROC IMPORT statement.
cetin
Calcite | Level 5

sory i am writing late

 

that code dont work

<span class="token statement">FILENAME</span> REFFILE <span class="token string">'/home/cetinkaygaldurak1/sasuser.v94/ULKE2_S.xlsx'</span><span class="token punctuation">;</span>
<span class="token procnames">proc</span> <span class="token procnames">import</span> datafile<span class="token operator">=</span>REFFILE
            dbms<span class="token operator">=</span>xlsx    
            out<span class="token operator">=</span>pg3<span class="token punctuation">.</span>deneme<span class="token punctuation">;</span>
    sheet<span class="token operator">=</span>ulke2_s<span class="token punctuation">;</span>
<span class="token procnames">run</span><span class="token punctuation">;</span>

 

this one is working why i dont add my dataset name is deneme  at pg3 library  and 

 

I can add deneme2 data to the work library  what is the difference i dont understand sory long question

 

FILENAME REFFILE '/home/cetinkaygaldurak1/sasuser.v94/ULKE2_S.xlsx';
proc import datafile=REFFILE
            dbms=xlsx    
            out=work.deneme;
    sheet=ulke2_s;
run;
FILENAME REFFILE '/home/cetinkaygaldurak1/sasuser.v94/ULKE2_S.xlsx';
proc import datafile=REFFILE
            dbms=xlsx    
            out=work.deneme2;
    sheet=ulke2_s;
run;

 

 

cetin
Calcite | Level 5

i think first code is working with xlsx engine so i dont add any dataset this library ---------------------(libname=pg3)

 

LIBNAME pg3 XLSX "/home/cetinkaygaldurak1/sasuser.v94/ULKE3.xlsx";
FILENAME REFFILE '/home/cetinkaygaldurak1/sasuser.v94/ULKE2_S.xlsx';
proc import datafile=REFFILE
            dbms=xlsx    
            out=pg3.deneme
            replace;
    sheet=ulke2_s;
run;

 

Ek Açıklama 2019-11-17 000848.png

PaigeMiller
Diamond | Level 26
LIBNAME pg3 XLSX "/home/cetinkaygaldurak1/sasuser.v94/ULKE3.xlsx";
FILENAME REFFILE '/home/cetinkaygaldurak1/sasuser.v94/ULKE2_S.xlsx';
proc import datafile=REFFILE
            dbms=xlsx    
            out=pg3.deneme
            replace;
    sheet=ulke2_s;
run;

The error is in the first line. You have established the libname PG3 to point to an Excel file. But you don't want that, as the OUT= creates a SAS data set and not an excel file. Thus, libname PG3 must be a folder, and not an Excel file (and not a file of any type), for example:

 

libname pg3 "/home/cetinkaygaldurak1/sasuser.v9";
--
Paige Miller
Tom
Super User Tom
Super User

Why do you want to convert an Excel sheet into a dataset and then immediately convert it back into another excel sheet?

What is the overall goal?

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 9 replies
  • 1305 views
  • 0 likes
  • 3 in conversation