Date: Fri, 8 Jul 2005 05:22:37 -0400
Reply-To: Jim Groeneveld <jim1stat@YAHOO.CO.UK>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jim Groeneveld <jim1stat@YAHOO.CO.UK>
Subject: Re: loops, macros and arrays
Content-Type: text/plain; charset=ISO-8859-1
Hi Arild,
I think you are quite right, but the idea is something for Rune to work out.
The macro call of course should be %Print_tp04 (Dykkerleger Dykkerregister);
which I typed with an erroneous space initially.
Regards - Jim.
--
Y. (Jim) Groeneveld, MSc., Biostatistician, Vitatron b.v., NL
Jim.Groeneveld_AT_Vitatron.com (replace _AT_ by AT sign)
http://www.vitatron.com, http://home.hccnet.nl/jim.groeneveld
My computer always teaches me something new I thought I knew already.
[common disclaimer]
-----Original Message-----
From: Skogmo, Arild [mailto:Arild.Skogmo@ssb.no]
Sent: Friday, July 08, 2005 10:14
To: Jim Groeneveld; RUNE@FASTLANE.NO
Subject: SV: Re: loops, macros and arrays
Double ampersands here and there? ,
for example in " &ant_tp04_&dykker_what._2_p); "
Change to: " &&ant_tp04_&dykker_what._2_p); ".
And call the macro like %Print_tp04 (DYKKERLEGER DYKKER ..)
to make for capital letters in the text?
Regards,
Arild
-----Opprinnelig melding-----
Fra: Jim Groeneveld [mailto:jim1stat@YAHOO.CO.UK]
Sendt: 8. juli 2005 09:56
Til: SAS-L@LISTSERV.UGA.EDU
Emne: Re: loops, macros and arrays
Hi Rune,
*Untested*:
%macro print_tp04 (dykker_list);
%GLOBAL I Dykker_What; * and possibly more, but some are global;
%LET I = 1;
%LET Dykker_What = %SCAN (&Dykker_List, &I, %STR( ));
%DO %WHILE (&Dykker_What NE );
%if &ant_tp04_&dykker_what._2_p > 0 %then
%do;
%global ant_tp04_&dykker_what.;
proc sql noprint;
select sum(ant_dup) into :ant_tp04_&dykker_what.
from &lib..tp04_&dykker_what._3;
run;
%global pst_dup_dykker_whatever;
%let pst_dup_dykker_whatever =
%sysfunc(round(%sysevalf
(100*&ant_tp04_&dykker_what./&ant_&dykker_what.),.01));
%let tabellnamn = tp04_&dykker_what._2_p;
%finn_tot_ant_rec(&tabellnamn, &ant_tp04_&dykker_what._2_p);
%finn_ant_rec_print(&print_alle, &prt_ant_default);
ods rtf text="There is &ant_tp04_&dykker_what. duplicate records
in &dykker_what..";
ods rtf text="This is &pst_dup_dykker_whatever percent of all
the
records in &dykker_what..";
ods rtf text="Below is shown &prt_ant of theese records.";
proc print data=&lib..tp04_&dykker_what._2_p (obs=&prt_ant)
noobs
label ;
run;
%end;
%LET I = %EVAL ( &I + 1 );
%LET Dykker_What = %SCAN (&Dykker_List, &I, %STR( ));
%END;
%mend;
Call: %Print_tp04 (Dykkerleger Dykker register)
Regards - Jim.
--
Y. (Jim) Groeneveld, MSc., Biostatistician, Vitatron b.v., NL
Jim.Groeneveld_AT_Vitatron.com (replace _AT_ by AT sign)
http://www.vitatron.com, http://home.hccnet.nl/jim.groeneveld
My computer always teaches me something new I thought I knew already.
[common disclaimer]
On Fri, 8 Jul 2005 08:17:31 +0200, Rune Runnestø <rune@FASTLANE.NO> wrote:
>Hi,
>here is an example of som programming. Imagine there is some datasets, and
>the task is to loop through theese datasets and perform the same kind of
>operations on all. Seems to me like a good candidate for a loop. In the
case
>here, there is just two datasets, but in real there is a lot more. But
here,
>just two for simplicity.
>When you look at the two macros, there is just one word that makes them
>different, that is 'dykkerleger' and 'dykkerregister'. I want to make an
>array with these strings, and loop through the two of them. May be I can
>manage just with the outer macro, 'print_tp04' ?
>
>Can anyone suggest a looping code ? How do I make the array values in
>UPPERCASE in the text ?
>
[.........]
|