BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Jedrzej
Obsidian | Level 7
 

Hi,

 

Is there a possibility that log can be outputed into txt file and also that it will be written into te sas log window ?

 

i've tried to copy witth altlog but without success.

 

proc printto log='destination';run;
option altlog=log;

1 ACCEPTED SOLUTION

Accepted Solutions
Quentin
Super User

Since altlog can only be turned on when SAS is invoked, it depends on how your are running SAS.

 

If you have PC SAS, you can add -altlog "c:\mylog" to your SAS configuration file, which is a file like C:\Program Files\SASHome\SASFoundation\9.4\nls\en\sasv9.cfg.  Or you can add -altlog "c:\mylog" to the icon you click to start a SAS session.  It's similar for other OS.

 

The challenge is if you're using something like EG or SAS studio to connect to a SAS server, you would likely need to talk with your administrator, as they control configuration options that are applied when SAS starts.

View solution in original post

6 REPLIES 6
PeterClemmensen
Tourmaline | Level 20
filename mylog 'YourPathHere\log.txt';

proc printto log=mylog;
run;

/* Some SAS Code */
data MyData;
   set sashelp.class;
run;

proc print data=MyData;
run;
Jedrzej
Obsidian | Level 7
how do you resolve my problem with this ? you just print one data step.
PeterClemmensen
Tourmaline | Level 20

Ah sorry, I missed the point here. I think the easiest is to use the ALTLOG System Option at startup in your Autoexec file. 

 

Otherwise, here is a thread with alternative solutions 🙂

 

https://communities.sas.com/t5/SAS-Programming/Outputting-log-to-two-locations/td-p/301336

Quentin
Super User

Agree, ALTLOG must be specified at startup.  You can't use it in an options statement. 

 

If you think it would be useful to be able to specify ALTLOG in an options statement, please add your vote to this ballot idea I submitted a few years back:  https://communities.sas.com/t5/SASware-Ballot-Ideas/Allow-ALTLOG-to-be-specified-on-OPTIONS-statemen...

 

 

Jedrzej
Obsidian | Level 7
so how to use altlog ? can your write a syntax example ?
Quentin
Super User

Since altlog can only be turned on when SAS is invoked, it depends on how your are running SAS.

 

If you have PC SAS, you can add -altlog "c:\mylog" to your SAS configuration file, which is a file like C:\Program Files\SASHome\SASFoundation\9.4\nls\en\sasv9.cfg.  Or you can add -altlog "c:\mylog" to the icon you click to start a SAS session.  It's similar for other OS.

 

The challenge is if you're using something like EG or SAS studio to connect to a SAS server, you would likely need to talk with your administrator, as they control configuration options that are applied when SAS starts.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

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!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1803 views
  • 1 like
  • 3 in conversation