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

Dear Community,

I am trying to import a lot of .csv files in somewhat automated way. Idea of mine is to get names of all file in a single table then import each file using macrovariables within DATASTEP.

 

But I have a trobule with getting files' names. I tried solution mentioned in thread: https://communities.sas.com/t5/SAS-Data-Management/how-to-get-list-of-files-available-in-Directory-i..., namely:

filename tmp pipe 'dir "folders/myfolders/*.csv" /b /s';

data want;
  infile tmp dlm="¬";
  length cmd_line $2000;
  input cmd_line;
run;

But I get following error:

ERROR: Insufficient authorization to access PIPE.

Is it possible to use something like this using SAS University Edition? If it matters, I am using SAS Studio.
Best regards,
Maks

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Have you tried this one?

 

https://documentation.sas.com/?docsetId=mcrolref&docsetTarget=n0js70lrkxo6uvn1fl4a5aafnlgt.htm&docse...

 


@caeduspl wrote:

Dear Community,

I am trying to import a lot of .csv files in somewhat automated way. Idea of mine is to get names of all file in a single table then import each file using macrovariables within DATASTEP.

 

But I have a trobule with getting files' names. I tried solution mentioned in thread: https://communities.sas.com/t5/SAS-Data-Management/how-to-get-list-of-files-available-in-Directory-i..., namely:

filename tmp pipe 'dir "folders/myfolders/*.csv" /b /s';

data want;
  infile tmp dlm="¬";
  length cmd_line $2000;
  input cmd_line;
run;

But I get following error:

ERROR: Insufficient authorization to access PIPE.

Is it possible to use something like this using SAS University Edition? If it matters, I am using SAS Studio.
Best regards,
Maks


 

View solution in original post

4 REPLIES 4
Reeza
Super User

Have you tried this one?

 

https://documentation.sas.com/?docsetId=mcrolref&docsetTarget=n0js70lrkxo6uvn1fl4a5aafnlgt.htm&docse...

 


@caeduspl wrote:

Dear Community,

I am trying to import a lot of .csv files in somewhat automated way. Idea of mine is to get names of all file in a single table then import each file using macrovariables within DATASTEP.

 

But I have a trobule with getting files' names. I tried solution mentioned in thread: https://communities.sas.com/t5/SAS-Data-Management/how-to-get-list-of-files-available-in-Directory-i..., namely:

filename tmp pipe 'dir "folders/myfolders/*.csv" /b /s';

data want;
  infile tmp dlm="¬";
  length cmd_line $2000;
  input cmd_line;
run;

But I get following error:

ERROR: Insufficient authorization to access PIPE.

Is it possible to use something like this using SAS University Edition? If it matters, I am using SAS Studio.
Best regards,
Maks


 

caeduspl
Fluorite | Level 6

Thank you. It is simple too and works.

Kurt_Bremser
Super User

External commands (and that includes filename pipe) are not available in UE, so you need to use the dopen and dread functions.

BTW, UE runs on UNIX, so the command would be ls, not dir.

caeduspl
Fluorite | Level 6

Thank you for pointing that out. I was not aware how it exactly works.

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
  • 4 replies
  • 2927 views
  • 4 likes
  • 3 in conversation