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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 854 views
  • 1 like
  • 4 in conversation