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

Hi dear,

 

Can someone please help me DREAD function from basic with clear example....

1 ACCEPTED SOLUTION

Accepted Solutions
Jagadishkatam
Amethyst | Level 16

Here is an article with examples which could be helpful, it also has dopen, dnum, dclose functions with examples

 

http://www.mwsug.org/proceedings/2012/S1/MWSUG-2012-S128.pdf

Thanks,
Jag

View solution in original post

2 REPLIES 2
Jagadishkatam
Amethyst | Level 16

Here is an article with examples which could be helpful, it also has dopen, dnum, dclose functions with examples

 

http://www.mwsug.org/proceedings/2012/S1/MWSUG-2012-S128.pdf

Thanks,
Jag
PGStats
Opal | Level 21
data files;
length file $128;
/* Define a filename pointing to the directory */
rc = filename("myDir", "C:\Users\PG\Documents\My SAS Files\9.4");
/* Open the directory, get directory id number */
dirId = dopen("myDir");
if dirId > 0 then do;
    /* dnum() : nb of files in directory */
    do i = 1 to dnum(dirId);
        /* Read the ith file name from directory */
        file = dread(dirId, i);
        if length(file) > 0 then output;
        end;
    /* Close the open directory */
    rc = dclose(dirId);
    end;
drop rc dirId i;
run;

proc print; run;
PG

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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