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.

BASUG is hosting free webinars Next up: Mark Keintz presenting History Carried Forward, Future Carried Back: Mixing Time Series of Differing Frequencies on May 8. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.

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...

 

 

BASUG is hosting free webinars Next up: Mark Keintz presenting History Carried Forward, Future Carried Back: Mixing Time Series of Differing Frequencies on May 8. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
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.

BASUG is hosting free webinars Next up: Mark Keintz presenting History Carried Forward, Future Carried Back: Mixing Time Series of Differing Frequencies on May 8. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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