I have a program that runs and it exports the log out to an external file for audit / tracking purposes. However this is not very useful for me while running the code. I want to be able to see the log in the SAS window as the codes are running and then jut have the log also in the external file for audit purposes.
Use the ALTLOG system option. This option has to be placed in your CONFIG file or in the SAS invocation command.
I can't seem to find a way to add ALTLOG to my CONFIG file. It might be that our IT dept has to do it as all settings are locked down and to be amended by "admin" only.
Yes, IT can and will lock down these files.
I made a copy of the CONFIG file and a copy of the shortcut that launches SAS, and placed these copies in a place where I can make changes to them. The copy shortcut properties needs to point to the copy of the CONFIG file you have made with the ALTLOG command included.
Thanks - I'm not sure I fully understand the full process of what needs doing. I've been reading on a separate thread on here on how to do this step by step but I'm not able to find something "for dummies" :). I can code well, but I dont fully understand all of the file and path amendments. Does anyone have this in a user friendly "for dummies" version I can follow?
Step 1. Copy the CONFIG file to a folder where you have write access, let's say the folder name is C:\users\Paige\SAS_Startup
Step 2. Edit the CONFIG file and add the proper -ALTLOG command into this CONFIG file, and save the file
Step 3. Copy the shortcut that launches SAS to the same folder as the new CONFIG file
Step 4. Right click on the shortcut, select properties, edit the properties to change the part after -CONFIG to "C:\users\Paige\SAS_Startup\sasv9.cfg" (or whatever folder and file name you used in Step 1). Click on OK
Step 5. Double-click on this new shortcut (do not use the old shortcut if you want this ALTLOG to work) to launch SAS
If you are changing the COMMAND you run there is no need to modify the CONFIG file since you can add the -altlog option to the COMMAND.
@Tom wrote:
If you are changing the COMMAND you run there is no need to modify the CONFIG file since you can add the -altlog option to the COMMAND.
True and the reason I do it the other way is that there is a limit on the number of characters you can enter into the Properties field, and so if you want a lot of characters in the -ALTLOG file name you may hit that limit, and have to then modify the CONFIG file. Plus, this allows a lot of other additions to the CONFIG file if desired, which also might cause the command to exceed the character limit.
thank you so much for the below - I'm stuck at:
Edit the CONFIG file and add the proper -ALTLOG command into this CONFIG file, and save the file
I'm not sure how to edit this. There is no option to "open as a text file" or any other alternative. When I right click the only option available is "open", but if I select this nothing happens. It does not even open SAS.
I have a feeling that the apps on our PCs are completely locked down for editing and hence why I'm not able to make this update.
@MarissaMarais wrote:
I have a feeling that the apps on our PCs are completely locked down for editing ...
Let's not jump to conclusions here.
To edit a copy (not the original) of your config file, that you have placed in a folder that you have write access to: Open an editor, such as Notepad or Notepad++ (but not Microsoft Word) and then use the File->Open menu command and select the config file.
@alepage wrote:
If I understand, this altlog options need to be configured by the SAS admin.
Not correct. On Windows, I was able to add -ALTLOG to my copy of the CONFIG file, even though my admin locked down the original copy of the CONFIG file. I have no idea on Unix.
No. The file pointed to by the -altlog system option has all of the log messages. The normal log (the one pointed to be the -log system option) does not include the sections re-directed by using the LOG= option of PROC PRINTTO.
You could add ONE MORE data step to make it happen.
%let file= c:\temp\temp.log ;
proc printto log="&file." new;run;
data have;
set sashelp.class;
run;
proc print data=have;run;
proc printto;run;
data _null_;
infile "&file";
input ;
putlog _infile_;
run;
Many thanks! Can I assume the code in the middle can just be my own code, and only the bits below need to be included for this to work?
%let file= c:\temp\temp.log ;
proc printto log="&file." new; run;
my own code...
proc printto;run;
data _null_;
infile "&file";
input ;
putlog _infile_;
run;
Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.
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.
Ready to level-up your skills? Choose your own adventure.