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

Hello Community,

Environment:

Enterprise Guide on UNIX via CITRIX over a Windows XP PC.

Situation:

I have serveral .CSV files located in /aaa/bbb/ccc/ddd

Now i would like to read all CSV files from this folder into a SAS table.

I only want to read the FILENAMES not the content.

I cant use "call system" or "filename x pile ..:" Statements. (Permissions)

I found another option by using the dopen() function.

When i try to open my file the dopenfunction returns a zero (file not found)

In the LOG  all files are accessed (see LOG)

Question:

I dont know what am I doing wrong? (im not having so much experience)

but why cant dopen open the directory and output my files.

Sourcecode

%let path = /aaa/bbb/ccc/ddd;

filename dir "&path/*";

data content;

    did=dopen("dir");

   if did eq 0 then do;

    infile dir length=linelen;

        input dir $Varying200. linelen;

   end;

   else do;

     msg=sysmsg();

      put msg;

   end;

run;

filename dir clear;

LOG:

NOTE: The infile DIR is:

      Filename=/aaa/bbb/ccc/ddd/2013-12-06-A.CSV,

      File List=/aaa/bbb/ccc/ddd/*,

    

NOTE: The infile DIR is:

      Filename=/aaa/bbb/ccc/ddd/2013-12-06-B.CSV,

      File List=/aaa/bbb/ccc/ddd/*,

 

NOTE: The infile DIR is:

      Filename=/aaa/bbb/ccc/ddd/2014-03-18-B.CSV,

      File List=/aaa/bbb/ccc/ddd/*,

 

NOTE: The infile DIR is:

      Filename=/aaa/bbb/ccc/ddd/2014-03-19-A.CSV,

      File List=/aaa/bbb/ccc/ddd/*,

    

WANT:

I want exactly this: 2013-12-06-A.CSV or the whole path /aaa/bbb/ccc/ddd/2014-03-19-A.CSV

in my table

can someone help me? I'm desperate...

Thanks

1 ACCEPTED SOLUTION
4 REPLIES 4
jakarman
Barite | Level 11

did you follow the example as of: SAS(R) 9.4 Functions and CALL Routines: Reference, Second Edition ?

It is the doptname function retrieving the information not the input statement.

What you have shown with the input statement is that a directory (with HFS as Unix/Windows)  is nothing more as a dataset. That dataset (directory) is having a list of pointers to ....

It is shamefull not having the OS layers for security in place as you can do everything with SAS. Oh they will try to block that also.

More easier would be allowing the x-cmd by you platform admin. When he did his work well putting you in an isolated secured box  sandbox. There is no security issue involved.

It is something like following the dogtail someone started it claiming it could be harmfull and without verifying understanding many followers. 

---->-- ja karman --<-----
jakarman
Barite | Level 11

Yes that is the one for the members with example

---->-- ja karman --<-----
asdf_sas
Calcite | Level 5

@Jaap Karmann

I totally agree with you...even  in a test envirnonment our permissions are restricted to nothing *laught

@Both

Thanks for the help it works Smiley Happy

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 3980 views
  • 7 likes
  • 3 in conversation