hi,
i am wondering how to transfer the dataset to memory, now i have a dataset in sas library, i am expected to transfer it to memory, it is my professer's suggestion, and i never try to do it before.
i knew that the stata operated in the memory. i have no idea about sas.
the 'memory' just is the thing displayed in the windows task manager.
thank you!
There's no point in transferring a data set to memory unless you plan to access it multiple times within your sas program. After all it has to be read from disk at least once.
But there is a way to load into memory. Take a look at documentation of the sasfile statement sasfile statement. It includes an example of "using sasfile in a program with multiple steps".
However, be aware of limitations. There are limited ways to modify the contens of a dataset loaded into memory via the sasfile statement. The table below has a list of limitations:
There's no point in transferring a data set to memory unless you plan to access it multiple times within your sas program. After all it has to be read from disk at least once.
But there is a way to load into memory. Take a look at documentation of the sasfile statement sasfile statement. It includes an example of "using sasfile in a program with multiple steps".
However, be aware of limitations. There are limited ways to modify the contens of a dataset loaded into memory via the sasfile statement. The table below has a list of limitations:
I'm guessing you likely mean you want to permanently save the dataset so you don't have to reimport it rather than actually save it to 'memory' which would usually be understood to be RAM.
You can do this by first assigning a permanent library and then copying the file to that location.
libname MEM '/folders/myfolders/perm';
data mem.class;
set sashelp.class;
run;
Remember, that to access the data in the future you'll need to re-assign the library if you haven't set it to be assigned automatically at start up.
thanks! as i knew little about the 'memory',actually, it is the RAM which you have mentioned above.
and i try the code like:
%let dsets = a ;
libname TEMP 'C:\Windows\TEMP' ACCESS=TEMP;
data temp.TEST_ML;
set &dsets;
run;
sorry for another question,is the TEMP 'cache' for sas? someone has told me that delete the 'temp' folder when you finished your work. i did not know the reson.
thank you!
Temp in this case is a library and the data is not deleted. Typically SAS datasets without a two level name (ie no libname) are stored in the WORK library. Anything in the work library is erased when you end your SAS session.
If you are trying to work in RAM, my first answer/code is incorrect.
If you're trying to work in memory, maybe you should explain what you want to do in memory. Is it a lookup, merge, sort?
I'm assuming this is an attempt to improve performance?
yeah, i want to improve the performance. and use the ram, sorry i called it 'memory'.
i think the path TEMP 'C:\Windows\TEMP' (which used to set up the 'temp' to use the RAM)
as 'C:\Windows\TEMP' this folder already exists there, maybe made automatically by sas. i am wondering if this folder can be used to transfer the dataset to ram. or i should set up a new folder named 'temp' in 'c' and change the path like'c:\temp'.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.