Hi,
I used to run code with SAS EG 7.x and I could easily keep all the logs by turning ON the project log. (see image).
All our code is .sas not SAS project (.egp) and I was able to view each step in the log which would be appended.
Is there a way to keep every thing with EG 8.x ? I don't want to create a project because all our programs are just .sas.
When I run a few datasteps, I like to check the logs first and then continue running the rest of the datasteps. Now I lose the trace of my previous steps in the log.
Thank you in advance.
Re:
If you prefer to work only with program files in Eguide 8.1 and not use a project, then another option is to use PROC PRINTTO and write the log out to an external file. You can append the logs by using the MOD function on a FILENAME statement:
filename test 'location_on_server\mylog.txt' MOD;
proc printto log=test; run;
As a note, if you use PROC PRINTTO, the enterprise Guide log will be empty. There isn't a way to write the SAS log to both SAS/Eguide and an external file.
I often use PROC PRINTTO to redirect the log in EG. Then because I want to see the log in EG as well, at the end of my code I reset PROC PRINTTO and read the log file and write it to the log window, e.g. :
proc printto log=log; *send proc printto log back to default log windows;
run;
data _null_;
infile mylog; *fileref pointing to the external log file;
input;
putlog _infile_;
run;
I still wish altlog could be turned on and off during a session. That would make it easy for to generate an external log file while also having the log written to the default log window.
Have you tried enabling project logs in EG 8?
AKAIK, there is no option if you are not using projects, that is just working with SAS programs.
Thank you @SASKiwi for looking into it.
I had already these check boxes selected and it doesn't help for the log. I don't think there is a way to enable the project log like in SAS EG 7.x.
I find it very annoying that all the info in the log gets replaced immediately when I run the following data step or part of code. I should be able to keep and view the previous steps like in the past. BASE SAS 9.4 and SAS EG 7.x were allowing that.
/*run and check log*/
Data test;
s=1;
run;
/*run and check log*/ /* NOW the log from previous step is gone */
Data test2;
s=1;
run;
/*run and check log*/ /* NOW the log from previous steps are gone */
Data test3;
s=1;
run;
While it may not have been obvious in Enterprise Guide 7.1 and earlier, all work done was within a project. That was the way Eguide worked before version 8, and why you were able to use the project log when running programs (.sas files). To mimic what you were doing in version 7.1, you can enable the option to automatically open a project file upon startup, and then make sure any programs you open are added to the project:
If you prefer to work only with program files in Eguide 8.1 and not use a project, then another option is to use PROC PRINTTO and write the log out to an external file. You can append the logs by using the MOD function on a FILENAME statement:
filename test 'location_on_server\mylog.txt' MOD;
proc printto log=test; run;
As a note, if you use PROC PRINTTO, the enterprise Guide log will be empty. There isn't a way to write the SAS log to both SAS/Eguide and an external file.
Thank you @jebjur for looking into it.
Like I wrote earlier to SASKiwi, I had already these checkboxes selected and still the SAS log window gets replaced each time when I run my 3 little datasteps separately. I wouldn't mind trying a SAS project (which is NOT really what i want to do).
Thank you for this little tip with a proc printto using the MOD. I like to learn new tricks.
It does the same thing though as not adding the MOD.
They are identical when I tested.....the info is appended each time.
filename test 'location_on_server\mylog.txt';
proc printto log=test; run;
filename test 'location_on_server\mylog.txt' MOD;
proc printto log=test; run;
Anyways, it is too bad that I have to create a project. There must be something that is missing on my side as it still does not work like you mentioned.
I also explored this below but not really good.
When I use Share> Log> Send to Windows defaults, it creates a log file for each datastep I run separately...not the best.
Anyways, if i could make the project work with the log keeping all the previous steps, it would at least help a bit.
Thank you.
Re:
If you prefer to work only with program files in Eguide 8.1 and not use a project, then another option is to use PROC PRINTTO and write the log out to an external file. You can append the logs by using the MOD function on a FILENAME statement:
filename test 'location_on_server\mylog.txt' MOD;
proc printto log=test; run;
As a note, if you use PROC PRINTTO, the enterprise Guide log will be empty. There isn't a way to write the SAS log to both SAS/Eguide and an external file.
I often use PROC PRINTTO to redirect the log in EG. Then because I want to see the log in EG as well, at the end of my code I reset PROC PRINTTO and read the log file and write it to the log window, e.g. :
proc printto log=log; *send proc printto log back to default log windows;
run;
data _null_;
infile mylog; *fileref pointing to the external log file;
input;
putlog _infile_;
run;
I still wish altlog could be turned on and off during a session. That would make it easy for to generate an external log file while also having the log written to the default log window.
Merci @Quentin. I really like your option to redirect the log into EG. Brillant.
It is a good alternative but SAS EG should think of a way to avoid rewriting the log elsewhere in order to keep all our steps.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.