Search notes:

SAS: proc presenv

Preserve the environment (global statements and environment variables) for later restart.
proc preserve works in tandem with the presenv option.

Simple example

Before ending a session, proc presenv is executed so as to store global statements etc:
options nopresenv;

data work.ds_1; x=42; run;
option linesize = 100;

options presenv;
data work.ds_2; x=99; run;
option pagesize = 99;

filename sess_fil '/share/home/tq84/sas/presenv/session.sas';
libname  sess_lib '/share/home/tq84/sas/presenv';

proc presenv
     permdir = sess_lib
     sascode = sess_fil
     show_comments;
run;

systask command 'ls -ltr /share/home/tq84/sas/presenv' shell='bash';
/*

   Hm... Also ds_1 was created...

   -rw-r--r--. 1 tq84 nobody 131072 Dec  8 14:35 ds_1.sas7bdat
   -rw-r--r--. 1 tq84 nobody 131072 Dec  8 14:35 ds_2.sas7bdat
   -rw-r--r--. 1 tq84 nobody 122880 Dec  8 14:35 sasmacr.sas7bcat
   -rw-r--r--. 1 tq84 nobody   3382 Dec  8 14:35 session.sas
*/
Github repository about-SAS, path: /programming/proc/presenv/session-end.sas
After starting a session, the stored session.sas file is included to restore the previous session:
options nopresenv;
%include '/share/home/tq84/sas/presenv/session.sas';
Github repository about-SAS, path: /programming/proc/presenv/session-start.sas

See also

SAS programming: proc
error handling

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/Companie...', 1758209553, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/Companies-Products/SAS/programming/proc/presenv/index(85): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78