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

So i'm in linux enviroment

i have this filename: text.01.xlsx

when I try to import

 

 

proc import 
datafile="/opt/test.01.xlsx"
dbms=xlsx out=simon replace;
sheet="sheet1";
getnames=yes;
run;

 

 

but is not working because of the dot in the middle of the filename test.01.xlsx

1 ACCEPTED SOLUTION

Accepted Solutions
BernyOsuna
Obsidian | Level 7
Hi Guys i figured it out
in Linux!!! you need a double // before the name of the file in order to work

proc import out= work.yes datafile="/opt//test.01.xlsx" dbms=xlsx replace;
run;

View solution in original post

9 REPLIES 9
ballardw
Super User

Can you show us the log from attempting that code.

 

Copy the log from the Proc import through any messages related. Paste into a code box opened with the </> icon to preserve formatting of any error message diagnostics.

Tom
Super User Tom
Super User

Probably the error message is just truncating.

 

Most likely there is some difference in the file name.

 

Check that the file actually exists.  For example try just reading the first 10 bytes using a data step.

data _null_; 
  infile '/opt/test.01.xlsx' recfm=f lrecl=10;
  input;
  list;
  stop;
run;

 

 

Are you using SAS/Studio?  Look for the file in the Files and Folders browsing panel and copy the full filename from the properties window of the file into your program.  

BernyOsuna
Obsidian | Level 7
It doesn show the ERROR any more but it brings no data into the dataset
ballardw
Super User

Some things. One notice that the RED text has two / before Test.01

I don't know why but if the system thinks those are there then a folder with no name is expected

 

Second, is /opt your mount point for data? Paths should always include a complete path from the os point of view.

 

Third: is this path one you are sure that your SAS system can see? If SAS executes on a server and your data is local then perhaps the server has a similar path that does not contain your data.

 

Of course you already checked that the case of the folder names is correct...

BernyOsuna
Obsidian | Level 7
Hi Guys i figured it out
in Linux!!! you need a double // before the name of the file in order to work

proc import out= work.yes datafile="/opt//test.01.xlsx" dbms=xlsx replace;
run;
Tom
Super User Tom
Super User

I have used Linux for a long time and never seen any place where // is required in filenames.

 

If you accidentally try to use Windows style \ in filenames then you can get it trouble on Linux because it will "eat" the first one since \ is the escape character in most unix shells. So to get a real \ you need two \\.

BernyOsuna
Obsidian | Level 7
Well, I don’t have too much of experience in linux environment but it did work.
Kurt_Bremser
Super User

Per se, Linux (as any other UNIX) does not need the double slash. Multiple dots in filenames are a UNIX staple since the beginning (1970s), and can be used as this code, run on SAS UE (which uses Linux), proves:

proc import
  out=test
  datafile="/folders/myfolders/test.01.xlsx"
  dbms=xlsx
  replace
;
run;

Log:

 73         proc import
 74           out=test
 75           datafile="/folders/myfolders/test.01.xlsx"
 76           dbms=xlsx
 77           replace
 78         ;
 79         run;
 
 NOTE:    Variable Name Change.  Beob. -> Beob_                           
 NOTE: One or more variables were converted because the data type is not supported by the V9 engine. For more details, run with 
       options MSGLEVEL=I.
 NOTE: The import data set has 19 observations and 6 variables.
 NOTE: WORK.TEST data set was successfully created.
 NOTE:  Verwendet wurde: PROZEDUR IMPORT - (Gesamtverarbeitungszeit):
       real time           0.04 seconds
       cpu time            0.02 seconds

So you had something else that caused your problem.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 1008 views
  • 0 likes
  • 4 in conversation