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

Hi,

 

Could someone help me to get the file names in a directory from Unix environment

 

Below code is for Windows, 


filename indata pipe 'dir "/home/euqyi/shared_folder/user_data/Vishal/pah/Inflated/Data Month March 2019/pah_dx_??????.txt" /b';

 

Will it work for Unix environment ? 

 

I am using the below piece of code 

 

filename indata pipe 'dir "/home/eupoq/shared_folder/user_data/Richard/pah/Inflated/Data Month March 2019/pah_dx_??????.txt" /b';

data file_list;
length fname $50;
infile indata truncover; /* infile statement for file names */
input fname $50.; /* read the file names from the directory */
call symput ('num_files',_n_); /* store the record number in a macro variable */
run;

 

And getting below error in Output data

 

 

 


fname

 

 


1 dir: cannot access /home/euqyi/shared_folder/user_

2 dir: cannot access /b: No such file or directory

 

Please help me on this.

 

Thanks,

Vishal

1 ACCEPTED SOLUTION

Accepted Solutions
7 REPLIES 7
koyelghosh
Lapis Lazuli | Level 10

@karthic2612 I think for Unix the dir counterpart is ls. May be you can try.

koyelghosh
Lapis Lazuli | Level 10

What is the purpose of /b in Windows?

karthic2612
Obsidian | Level 7

we can use the DOS command "dir" with the /B option to list only the file names.

 

Thanks,

Vishal

koyelghosh
Lapis Lazuli | Level 10

Then just replacing dir with ls and not using /b is my suggestion. May be this will work.

karthic2612
Obsidian | Level 7

Thanks...

 

It worked for me. By replacing ls with dir and /b option.

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
  • 7 replies
  • 2424 views
  • 0 likes
  • 3 in conversation