BookmarkSubscribeRSS Feed
FFR
Calcite | Level 5 FFR
Calcite | Level 5

What determines the sequence number of some file in some directory (UNIX)?

I wanted to use DREAD(&dir,1) to read the filename of the first file in the direcotry in alphabetical order, but it doesn't work since the sequence is not alphabetical and also not date or file size. But what is it then?

The documentation for the  DREAD function only says:

nval

is a numeric constant, variable, or expression that specifies the sequence number of the member within the directory.

I think there should be some information on what the sequence number actually is.

4 REPLIES 4
Ron_MacroMaven
Lapis Lazuli | Level 10

Here is a page with programs for making lists.

Making Lists - sasCommunity

make the list of filenames then sort by filename.

I have no idea where the nval value is assigned.

This is similar to the order of macro variables: makes no obvious sense.

ballardw
Super User

Use Dnum for the number of members and loop over the value 1 to dnum to get the name for each numbered file in a data set. Then use that to get other characteristics, sort and process by the sorted order.

I don't know the Unix file system well enough but I suspect there is a reason for order. And which date did you look at? Was it a date updated, created, read, "touched" or something else?

FFR
Calcite | Level 5 FFR
Calcite | Level 5

Thanks Ron and ballardw for the hints. Actually I solved my problem in a similiar way. I am just curios how DREAD works - also to use it as it is and not with some workaround.

Date was date updated and I just checked that it's not date created. As it really seems arbitrary my guess would be that it uses the order on the hard drive, i.e. the order in which files in the direcotry are read.

PS: Does someone know the guy who implemented this function? I guess he or she knows 😉

MadhuKorni
Quartz | Level 8

You can find the usage of Dread in this thread

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
  • 4 replies
  • 1135 views
  • 0 likes
  • 4 in conversation