<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Splitting log and executing a set of subjects together in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Splitting-log-and-executing-a-set-of-subjects-together/m-p/531580#M145520</link>
    <description>&lt;P&gt;I pointed out the issues I could see in your (clearly incomplete) code. Fix those, and study the log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For detailed help, we will need example data in usable form (see my footnotes), the whole macro code and at least a good idea what the macro looper does.&lt;/P&gt;</description>
    <pubDate>Thu, 31 Jan 2019 08:16:45 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2019-01-31T08:16:45Z</dc:date>
    <item>
      <title>Splitting log and executing a set of subjects together</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-log-and-executing-a-set-of-subjects-together/m-p/531557#M145503</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have enrollment dataset of 10 subjects. Upon matched subjects from enrollment subjects rest of the forms (demog, conmeds,hxsys) subjects are extracted with its data. example , demog extracted&amp;nbsp; has 10 subjects, conmeds extracted for 23 subjects(same 10 subjects&amp;nbsp; with different data ) and hxsys has 12 subjects.Now my requirement is, for those 10 subjects of enrollment need to execute 3 at a time and generate log for those 3&amp;nbsp;and sleep for 1 minute , for next iteration 4 to 6 and sleep for 1 minute and so on.the task here is, for subject '123' we have multiple information in conmeds and hxsys. So considering this , if subject '123' comes in 1st iteration all the irecords for '123'&amp;nbsp; should be executed. Here I have a major parts of my code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/***creating enrollment dataset****////&lt;/P&gt;&lt;P&gt;data test.enrlment_1;&lt;BR /&gt;set enrlment_1;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data _NULL_;&lt;BR /&gt;if 0 then set enrlment_1 nobs=n;&lt;BR /&gt;call symputx('nrows',n);&lt;BR /&gt;stop;&lt;BR /&gt;run;&lt;BR /&gt;%put nobs=&amp;amp;nrows;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/**all forms dumpped in final dataset, creating macro ***////&lt;BR /&gt;data _null_;&lt;BR /&gt;set final_1 end=eof;&lt;BR /&gt;call symput('pt'||compress(put(_n_,best.)),trim(left(upcase(subject))));&lt;/P&gt;&lt;P&gt;if eof then call symput('npts',compress(put(_n_,best.)));&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;****creating macro variable to create or run the report conditionally******;&lt;/P&gt;&lt;P&gt;%let count=0;&lt;/P&gt;&lt;P&gt;data _null_ ;&lt;BR /&gt;set final_1 end=eof NOBS=COUNT;;&lt;BR /&gt;countc = put(count,best.);&lt;BR /&gt;if _n_ = 1 then call symput('count',countc);&lt;BR /&gt;run;&lt;BR /&gt;%put &amp;amp;count;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/***After sepating each form from enrollment, looper macro created for ods. In Read macro looper macro is called****/////&lt;/P&gt;&lt;P&gt;%macro read;&lt;BR /&gt;%do j=1 %to &amp;amp;nrows;&lt;BR /&gt;%if %sysfunc(mod(&amp;amp;j,3))=1 %then&lt;/P&gt;&lt;P&gt;%do;&lt;/P&gt;&lt;P&gt;proc printto new log ="/ctshared/cdr/dev/RAMYA/archive/logfile_&amp;amp;j..log";&lt;/P&gt;&lt;P&gt;run;&lt;BR /&gt;%let rc=%sysfunc(sleep(60,1));&lt;BR /&gt;%end;&lt;/P&gt;&lt;P&gt;%do i=1 %to &amp;amp;npts;&lt;/P&gt;&lt;P&gt;%looper(subject=&amp;amp;&amp;amp;pt&amp;amp;j.);&lt;/P&gt;&lt;P&gt;%end;&lt;BR /&gt;%end;&lt;BR /&gt;%mend caller();&lt;BR /&gt;%caller();&lt;/P&gt;&lt;P&gt;%mend read;&lt;BR /&gt;%read;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 06:11:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-log-and-executing-a-set-of-subjects-together/m-p/531557#M145503</guid>
      <dc:creator>Ramya2</dc:creator>
      <dc:date>2019-01-31T06:11:51Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting log and executing a set of subjects together</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-log-and-executing-a-set-of-subjects-together/m-p/531573#M145515</link>
      <description>&lt;P&gt;This won't work:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro read; /* here you start defining macro read */
%do j=1 %to &amp;amp;nrows;
%if %sysfunc(mod(&amp;amp;j,3))=1 %then

%do;

proc printto new log ="/ctshared/cdr/dev/RAMYA/archive/logfile_&amp;amp;j..log";

run;
%let rc=%sysfunc(sleep(60,1));
%end;

%do i=1 %to &amp;amp;npts;

%looper(subject=&amp;amp;&amp;amp;pt&amp;amp;j.);

%end;
%end;
%mend caller(); /* but here you end the definition of macro caller ???? */
%caller();

%mend read;
%read;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;DO NOT EVEN ATTEMPT to nest macro definitions. All macros are defined in the global table, so nesting macro definitions only causes confusion and serves no other purpose.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 07:07:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-log-and-executing-a-set-of-subjects-together/m-p/531573#M145515</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-01-31T07:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting log and executing a set of subjects together</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-log-and-executing-a-set-of-subjects-together/m-p/531576#M145518</link>
      <description>Then what will be the solution</description>
      <pubDate>Thu, 31 Jan 2019 07:29:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-log-and-executing-a-set-of-subjects-together/m-p/531576#M145518</guid>
      <dc:creator>Ramya2</dc:creator>
      <dc:date>2019-01-31T07:29:34Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting log and executing a set of subjects together</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-log-and-executing-a-set-of-subjects-together/m-p/531580#M145520</link>
      <description>&lt;P&gt;I pointed out the issues I could see in your (clearly incomplete) code. Fix those, and study the log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For detailed help, we will need example data in usable form (see my footnotes), the whole macro code and at least a good idea what the macro looper does.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 08:16:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-log-and-executing-a-set-of-subjects-together/m-p/531580#M145520</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-01-31T08:16:45Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting log and executing a set of subjects together</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-log-and-executing-a-set-of-subjects-together/m-p/531587#M145526</link>
      <description>&lt;P&gt;Rethink your process.&amp;nbsp; Almost all tasks boil down to get data, process data, produce output (there is even an anacronym ETL - Extract, Transform, Load).&amp;nbsp; So why do you have "get some bits of data", "do something", "sleep", "do it again"?&amp;nbsp; Doesn't make any sense, and sounds like the whole process is bad.&amp;nbsp; For instance, from the code you provide it looks like your producing a report, perhaps by three subjects?&amp;nbsp; If so read all the data in then add a variable called group or something.&amp;nbsp; Then use proc report with by group; to produce one report per block of three.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 08:39:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-log-and-executing-a-set-of-subjects-together/m-p/531587#M145526</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2019-01-31T08:39:36Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting log and executing a set of subjects together</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-log-and-executing-a-set-of-subjects-together/m-p/531624#M145543</link>
      <description>&lt;P&gt;Agree with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;&amp;nbsp;.&amp;nbsp; Think about creating the data you want (sounds like it will have a subject ID, and multiple records per subject).&amp;nbsp; Then think about the reporting you want.&amp;nbsp; Often the answer is BY-group processing.&amp;nbsp; If you really have been given a requirement to have a separate log for each by group, then you probably need to use the macro language or some other code generation technique.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using SASHELP.SHOES as an example dataset, and making one report per region, if you have a macro like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro MkReport(region=) ;
  proc printto new log ="c:\junk\logfile_&amp;amp;region..log";
  run;
  proc print data=sashelp.shoes ;
    where region="&amp;amp;region" ;
  run ;
  proc printto ;
  run ;
%mend MkReport ;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Which you call like below, to make a report for Canada and a log file for Canada:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mprint ;
%MkReport(region=Canada)
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You could use the dataset to drive the macro via call execute, which for data-driven code is often handier than macro looping:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_ ;
  set sashelp.shoes ;
  by region ;
  if first.region then do ;
    call execute('%nrstr(%MkReport(region='||trim(region)||'))') ;
  end ;
run ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;That will call the macro %MkReport once for each region.&amp;nbsp; When the macro executes, it redirects the log file and then generates the report.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That said, the requirement to have separate log files is unusual.&amp;nbsp; Usually this sort of looping over is unnecessary, as&amp;nbsp; BY group processing is much more efficient.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 13:03:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-log-and-executing-a-set-of-subjects-together/m-p/531624#M145543</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2019-01-31T13:03:12Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting log and executing a set of subjects together</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-log-and-executing-a-set-of-subjects-together/m-p/532833#M146037</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19879"&gt;@Quentin&lt;/a&gt; , Yes I understand your advice. But as per the requirement I should split the log files. Since data is huge it is consuming more disk spae. So it is adviced to do so.</description>
      <pubDate>Tue, 05 Feb 2019 03:31:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-log-and-executing-a-set-of-subjects-together/m-p/532833#M146037</guid>
      <dc:creator>Ramya2</dc:creator>
      <dc:date>2019-02-05T03:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting log and executing a set of subjects together</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-log-and-executing-a-set-of-subjects-together/m-p/532835#M146038</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/254855"&gt;@Ramya2&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19879"&gt;@Quentin&lt;/a&gt; , Yes I understand your advice. But as per the requirement I should split the log files. Since data is huge it is consuming more disk spae. So it is adviced to do so.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;By group processing will be more efficient than calling the same SAS table many times with a where condition.&lt;/P&gt;
&lt;P&gt;The size of the SAS log doesn't depend on the data volumes you're processing but only on the number of steps/lines of code and level of logging.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Feb 2019 04:21:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-log-and-executing-a-set-of-subjects-together/m-p/532835#M146038</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-02-05T04:21:01Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting log and executing a set of subjects together</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-log-and-executing-a-set-of-subjects-together/m-p/532869#M146059</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/254855"&gt;@Ramya2&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Since data is huge it is consuming more disk spae.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That is a patently wrong argument. Splitting files &lt;EM&gt;increases&lt;/EM&gt; disk storage consumption.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Feb 2019 09:50:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-log-and-executing-a-set-of-subjects-together/m-p/532869#M146059</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-02-05T09:50:14Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting log and executing a set of subjects together</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-log-and-executing-a-set-of-subjects-together/m-p/532884#M146061</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&lt;BR /&gt;ohhh.. But what you think is a best solution apart from increasing the disk space?Through pro grammatically What can we done?</description>
      <pubDate>Tue, 05 Feb 2019 11:01:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-log-and-executing-a-set-of-subjects-together/m-p/532884#M146061</guid>
      <dc:creator>Ramya2</dc:creator>
      <dc:date>2019-02-05T11:01:02Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting log and executing a set of subjects together</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-log-and-executing-a-set-of-subjects-together/m-p/532897#M146065</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/254855"&gt;@Ramya2&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&lt;BR /&gt;ohhh.. But what you think is a best solution apart from increasing the disk space?Through pro grammatically What can we done?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;When you run out of disk space, start with assessing the "is" situation:&lt;/P&gt;
&lt;UL style="list-style-position: inside;"&gt;
&lt;LI&gt;how much space is available in the first place?&lt;/LI&gt;
&lt;LI&gt;is there something that limits available space on top of that (user quota)?&lt;/LI&gt;
&lt;LI&gt;what file exactly causes the overflow? Logs are usually not that big, but datasets or utility files are&lt;/LI&gt;
&lt;LI&gt;if it is the log, inspect it&lt;/LI&gt;
&lt;LI&gt;if it is datasets, inspect them for content (columns, observations)&lt;/LI&gt;
&lt;LI&gt;if it is a certain step that fails, isolate that and see what's happening in detail, especially with SQL&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Once you &lt;EM&gt;really&lt;/EM&gt; know what's happening, you can work on a remedy.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Feb 2019 12:06:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-log-and-executing-a-set-of-subjects-together/m-p/532897#M146065</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-02-05T12:06:34Z</dc:date>
    </item>
  </channel>
</rss>

