BookmarkSubscribeRSS Feed
LineMoon
Lapis Lazuli | Level 10

Hello,

Please a want to create one log file for all the treatement ( log_all_trt.txt)  and a log file file for every sub-treatement ( log_treatement_1.txt, log_treatement_2.txt....)

 

I want this treatement  to be in log file: log_all_trt.txt

 

proc print data=toto; run;  =                  => I want this treatement  to be in log file : log_treatement_1.txt

 

proc compare base=t1 comp=t2; run;  => I want this treatement  to be in log file : log_treatement_2.txt

 

Thank you

3 REPLIES 3
dkb
Quartz | Level 8 dkb
Quartz | Level 8

Have a look at the documentation for PROC PRINTTO:

 

http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a000146809.htm

 

 

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Well, there are a couple of points in there.  Firstly why do you want to split a log - which is the description of a program run, not data - based on data?  This doesn't make sense.  If you want to create output files on a by group within your data, then do that in proc report.  Now saying that, to split it out into different files, you would need to create a loop over the distinct treatment values:
proc sql;

  create table LOOP as 

  select distinct TRT 

  from   HAVE;

quit;

data _null_;

  set loop;

  call execute(cats('%print_data (indat=have,rep_name=report_',trt,',whre=',trt,');');

run;

 

The above code will create a call to print data macro for each trt.  Something like that can be used to create any output files (e.g. log), however personall I wouldn't associate a log - again which is a run of code - with a data report.

kannand
Lapis Lazuli | Level 10

Hi,

 

I'm not sure of what platform you are running this on, but if you are using mainframe Z/OS, you might consider having one subtreatment in a generational file and then at the end in a separate JCL step, you might concatenate the gdgs into one dataset through a SyncSort - Copy option and you will have all subtreatments combined to one master dataset. 

 

The individual generations will be pointing to sub-treatments and the output of the SyncSort  copy will hold the master data that includes all subtreatments. 

 

If you are running in a Unix platform, you might use a concatenation utility to do what Syncsort does on the mainframe.

 

Hope this helps...!!!

 

 

Kannan Deivasigamani

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
  • 3 replies
  • 1535 views
  • 1 like
  • 4 in conversation