Hello,
I would like to have more information on two things.
First:
Filename dest1 temp;
THE TEMP DEVICE
The TEMP device allows you to create a temporary file that exists only as long as the filename is assigned. There are
many reasons why you would need to use a temporary file in a SAS program. But is it possible to see the content of that file with SAS EG ?
Also, another statement that I saw on the web is:
"%sysfunc(getoption(WORK))/filename"
ex: "%sysfunc(getoption(WORK))/directories.json"
My understanding is that a file directories.json is created into the work library but is it possible to see it ? What are the advantages and disadvantages of these temporary files.
Thanks to improve my knowledges.
If you want to see the contents of such a file you can always do
data _null_;
infile dest1;
input;
put _infile_;
run;
and read the log.
But such a temporary file has always been created by the current process, so the owner of the process MUST positively know what he/she put in there 😉
@alepage wrote:
Hello,
I would like to have more information on two things.
First:
Filename dest1 temp;
THE TEMP DEVICE
The TEMP device allows you to create a temporary file that exists only as long as the filename is assigned. There are
many reasons why you would need to use a temporary file in a SAS program. But is it possible to see the content of that file with SAS EG ?
Since you have created the filename, and since you know what is written into that filename (because you have written the program), you should know what is in there. You can also look at what is in there exactly the same as you would look for files in any filename. You didn't quote enough of the documentation, which also says "Files manipulated by the TEMP device can have the same attributes and behave identically to DISK files."
"%sysfunc(getoption(WORK))/filename"
ex: "%sysfunc(getoption(WORK))/directories.json"
The commands above have to be part of a longer SAS command, as by itself "%sysfunc(getoption(WORK))/filename" is meaningless. Please provide context here.
"What are the advantages and disadvantages of these temporary files."
Advantage - they are temporary.
Disadvantage - they are temporary.
If you have:
Filename dest1 temp;
run:
Filename dest1 LIST;
and see the log.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.