|
A example which might do what you need (SASHELP.CLASS, cause I don't have
your data):
data dm as cg cm;
set sashelp.class;
run;
%macro report(study);
%let module=dm as cg cm;
ods listing close;
ods rtf file = "\cotest.rtf";
%do i=1 %to 4;
%let domain=%scan(&module,&i);
options nodate nonumber;
options orientation=landscape;
proc report data=&domain NOWINDOWS box missing ;
title "&study";
title2 "Data definition file of %upcase(&domain)";
column name ;
define name / order order=data 'Name' ;
run;
%end;
ods rtf close;
ods listing;
%mend report;
%report(study85)
On Tue, 11 Mar 2008 12:12:07 -0400, Gerhard Hellriegel
<gerhard.hellriegel@T-ONLINE.DE> wrote:
>after reading that again:
>
>your
>
>%let domain=%scan...
>
>has to be IN your loop for sure!!!!!
>
>Outside the loop there is NO CHANGING &i! At first run, you'll get &i not
>resolved, at subsequent runs you'll get the last state of &i after the
>loop. In &domain there is always the same value.
>
>So:
>
>the %scan into the loop, the ODS - statements (open and close) outside, to
>get one file with all your 4 domains.
>
>Gerhard
>
>
>
>On Tue, 11 Mar 2008 08:45:36 -0700, adityasikka82@gmail.com
><adityasikka82@GMAIL.COM> wrote:
>
>>Hi :
>>
>>well their is one more problem with moving do loop though it is giving
>>4 outputs now but all of a same module i.e first module not of
>>different modules
>>
>>
>>Thanks
>>
>>
>>
>>
>>
>>
>>On Mar 11, 11:26 am, "adityasikk...@gmail.com"
>><adityasikk...@gmail.com> wrote:
>>> Hi all
>>>
>>> Thanks for your great inputs.
>>> I moved my do loop after rtf/pdf location now i am able to get
>>> consolidated
>>> report of all the domains.
>>>
>>> Thanks again
>>>
>>> Final code:
>>> *
>>>
>>> %macro* report(study);
>>>
>>> %let module=dm as cg cm ae ;
>>>
>>> *%let i=1;
>>>
>>> %let domain=%scan(&module,&i," ");
>>>
>>> options nodate nonumber;
>>>
>>> options orientation=landscape;
>>>
>>> ods listing close;
>>>
>>> ods rtf file = "xyz\define\consolidate.rtf" ;
>>>
>>> %do i=*1* %to *4*;
>>>
>>> proc report data=lib6.&domain NOWINDOWS box missing ;
>>>
>>> title 'Study 85';
>>>
>>> title2 "Data definition file of %upcase(&domain)";
>>>
>>> *footnote "Listings produced on %sysfunc(today(),worddate12.)";
>>>
>>> column name type label format length origin comments;
>>>
>>> define name / order order=data 'Name' ;
>>>
>>> define label / order order=data 'Label' ;
>>>
>>> define type / order order=data center 'Type' ;
>>>
>>> define format / order order= data 'Format' ;
>>>
>>> define length / order order=data center 'Length';
>>>
>>> define comments / order order=data 'Comments';
>>>
>>> %end;
>>>
>>> run;
>>>
>>> ods rtf close;
>>>
>>> ods listing;
>>>
>>> quit;
>>>
>>> *%mend* report;
>>>
>>> %*report*(study85)
>>>
>>> On Mar 11, 10:52 am, gerhard.hellrie...@T-ONLINE.DE (Gerhard
>>>
>>>
>>>
>>> Hellriegel) wrote:
>>> > On Tue, 11 Mar 2008 07:16:14 -0700, adityasikk...@gmail.com
>>>
>>> > <adityasikk...@GMAIL.COM> wrote:
>>> > >Hi,
>>>
>>> > >I am using the following macro
>>>
>>> > >%macro report(study);
>>> > >%let module=dm as cg cm;
>>> > >*%let i=1;
>>> > >%do i=1 %to 4;
>>>
>>> > >%let domain=%scan(&module,&i," ");
>>>
>>> > >options nodate nonumber;
>>> > >options orientation=landscape;
>>> > >ods listing close;
>>> > >ods rtf file = "xyz\consolidate.rtf" ;
>>>
>>> > >proc report data=lib6.&domain NOWINDOWS box missing ;
>>> > > title 'Study 85;
>>> > > title2 "Data definition file of %upcase(&domain)";
>>>
>>> > > column name type label format length origin comments;
>>> > > define name / order order=data 'Name' ;
>>> > > define label / order order=data 'Label' ;
>>> > > define type / order order=data center 'Type' ;
>>> > > define format / order order= data 'Format' ;
>>> > > define length / order order=data center 'Length';
>>> > > define comments / order order=data 'Comments';
>>>
>>> > >%end;
>>> > > quit;
>>> > >run;
>>>
>>> > > ods rtf close;
>>> > > ods listing;
>>>
>>> > > %mend report;
>>> > > %report(study85)
>>>
>>> > >Now the problem i am facing is that, Log is giving no errors and all
>>> > >four variables dm as cg cm are resolved but in the pdf output is
only
>>> > >showing last 2 files ( cg and cm) and not all the files although
>macro
>>> > >is resoling all 4 variables.
>>>
>>> > >Please guide.
>>> > >Thanks
>>>
>>> > You seem to have more than one problem:
>>>
>>> > one quote is unclosed:
>>>
>>> > title 'Study 85;
>>>
>>> > Why don't you use
>>>
>>> > title "&study"; ?
>>>
>>> > 2.: your ODS start-statements are IN the loop. They should come
>before the
>>> > loop starts.
>>> > Try that...
>>> > Gerhard- Hide quoted text -
>>>
>>> > - Show quoted text -- Hide quoted text -
>>>
>>> - Show quoted text -
|