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

Just did some searching and reading on SAS log file directing.  And, phew!, seems to be a crazy topic, all across the board.

 

Simply put, I'd like to process several datasets, one at a time:

 

aaa.sas7bdat

bbb.sas7bdat

ccc.sas7bdat

 

Each dataset resides within its own folder:

 

c:\1\aaa\aaa.sas7bdat

c:\1\bbb\bbb.sas7bdat

c:\1\ccc\ccc.sas7bdat

 

(I'd like to process all the datasets using a macro.  But will inquire about how to do that tomorrow.)

 

For now, when processing aaa.sas7bdat, I would like to create a log -- log_aaa.txt -- within c:\1\aaa\.

 

Following completion of that process, I'd like to move on to bbb.sas7bdat.  And during the process create a new log file -- log_bbb.txt.  That file should reside in the respective c:\1\bbb\.

 

On and on....

 

You get the picture?

 

Any sage advice on how best to do this will be greatly appreciated.

 

Thanks!

 

Nicholas Kormanik

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

 

proc printto log="c:\1\aaa\log_aaa.txt"; /* Re-direct log to the file named */
run;

/* Any code for data set aaa goes here */

proc printto; /* Turns off sending log to file named above */
run;
--
Paige Miller

View solution in original post

3 REPLIES 3
PaigeMiller
Diamond | Level 26

 

proc printto log="c:\1\aaa\log_aaa.txt"; /* Re-direct log to the file named */
run;

/* Any code for data set aaa goes here */

proc printto; /* Turns off sending log to file named above */
run;
--
Paige Miller
Kurt_Bremser
Super User

This should get you an idea:

%macro process(loc=);

proc printto log="c:\1\&loc.\log_&loc..txt";
run;

libname process "c:\1\&loc.";

data temp;
set process.&aaa.;
/* further processing */
run;

proc printto log=log; /* reroute to default */
run;

%mend;

Then call that repeatedly:

%process(loc=aaa);
%process(loc=bbb);
%process(loc=ccc);
NKormanik
Barite | Level 11

@PaigeMiller  Clear as day!!

 

@Kurt_Bremser  Uhhh.....  (#@%!)

 

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
  • 3 replies
  • 527 views
  • 4 likes
  • 3 in conversation