Date: Tue, 11 Mar 2008 12:05:59 -0400
Reply-To: Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Subject: Re: macro problem
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 -
What do you mean with "module"? Your RTF file?
What do you want? 4 different RTF files? In that case you should move the
ODS statements INTO the loop, but also the ODS RTF CLOSE;
Now you should rename that files, otherwise you always write over the old
one:
ods listing close;
%do i=1 %to...;
%let domain=%scan...;
ods rtf file="/xyz/abc&domain..rtf";
proc report....;
ods rtf close;
%end;
ods listing;
Gerhard
|