Sometime, one wants to work on a large table's subset and load it in memory for fast processing using the sasfile statement.
At the moment, the only way to do this is to create a new table from the large table
This generates an unnecessary and large amount of disk access to read and write the wanted data.
It would be useful if the wanted data could be loaded directly as in:
set YEAR2012(keep=MONTH V;
sasfile SEP2012 load;
This is a tough one, because I see what you're wanting to do intellectually, but there's a few issues I can see with the practicalities of generalising it.
What you really want, I think, is to define a memory resident library/ramdisk and then output your subset dataset to memory without the additional read/write cycle required to create the intermediate file using the disk. Have a look at memory based libraries and some other options in that document for practical ideas in this regard.
Now, the reason I can't just vote for a resounding "YES!":
I don't work or speak for SAS, but I've got a lot of experience using sasfile and views and put them to use a lot in my own work so I feel I've got a good background on the theory of what's going on behind the scenes even though I haven't seen SAS's source code.
In many ways, your request requires the blurring of the line of what a VIEW is/can be. That is to say, a VIEW is a construct that provides meta-information on how to serve up observations one at a time. You can treat the set of the observations served up ALMOST exactly like a data set in SAS code, as in your subset example, but they're not quite the same thing. You can't randomly access observations in a SAS view (the code might run, i'm not sure, but I'm guessing it will act like a physical data set output to disk). And there's two more abstract uses of views that I use in my work:
- Theoretically infinite views: Which is to say a view can be defined to represent a data set of theoretically infinite size.
- Non-deterministic views: Which is to say, a view can be defined such that there IS NO ONE STATIC DATASET to be held in memory that reflects what accessing that view will be each time it is used.
Hence, back to my eariler statement. What I think you REALLY want, is a way to write a data set to memory without an intermediate step of writing it to disk, and then reading it from disk into memory.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.