Date: Mon, 20 Dec 2004 15:45:21 +0000
Reply-To: holger.bargen@GAB-BIOTECH.DE
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Holger Bargen <holger.bargen@GAB-BIOTECH.DE>
Subject: Re-2: conditional macro start
Content-Type: text/plain; charset="iso-8859-1"
It works!!!
Thank you very much!
Best wishes for nice Christmas days/holiday season to everyone at this forum and especially to those experts, who gave me some help to solve my problem!
Holger
-------- Original Message --------
Subject: Re: conditional macro start (20-Dez-2004 16:31)
From: chang_y_chung@HOTMAIL.COM
To: holger.bargen@gab-biotech.de
> On Mon, 20 Dec 2004 05:54:47 -0500, Holger Bargen <holger.bargen@GAB-
> BIOTECH.DE> wrote:
>
> >Dear all,
> >I want to conduct different tests depending on the number of Doses, which
> >are included in the data set. I wrote a program code as you'll find below.
> >The tests are conducted correctly, but the maximum Level seems not to be
> >detected correctly, which could be caused by incorrect definition of the
> >maximum level ("ly") or the ly - value is not correctly available for the
> >if - statement.
> >Maybe I programmed complet nonsense. I am a newby in programming macro
> >codes. Has anyone an idea of how I could solve the problem?
> >Thanks and best regards,
> >Holger
> >
> >
> >data morty;
> > input Level Dose$ @;
> > do i= 1 to 5;
> > input mortyr @;
> > output;
> > end;
> > drop i;
> >cards;
> >1 Control 8.7 12.5 9.0 9.5 8.2
> >2 V1 9.9 8.6 2.8 5.5 11.5
> >run;
> >
> >
> >Here is the code of Macro caseA and caseB, conducting different
> >statistically analysis depending if the problem is pairwise or multiple.
> >
> >%Macro uni;
> >proc univariate data=morty;
> >var Level;
> >output max = ly;
> >run;
> >%mend uni;
> >
> >%Macro runny;
> >%uni;
> >%if ly > 2 %then
> >%do;
> >%caseA;
> >%end;
> >%else
> >%do;
> >%caseB;
> >%end;
> >%mend runny;
> >
> >%runny;
>
>
> Hi, Holger,
>
> Here is one way. As a newbie code, I think yours looks great! I am
> especially impressed by the fact that you organize it into logically
> divided small pieces.
>
> Cheers,
> Chang
>
> data morty;
> input Level Dose$ @;
> do i= 1 to 5;
> input mortyr @;
> output;
> end;
> drop i;
> cards;
> 1 Control 8.7 12.5 9.0 9.5 8.2
> 2 V1 9.9 8.6 2.8 5.5 11.5
> ;
> run;
>
> %macro caseA;
> %*-- just a place holder --*;
> %put caseA;
> %mend;
>
> %macro caseB;
> %*-- just a place holder --*;
> %put caseB;
> %mend;
>
> %macro driver;
>
> %*-- get the maximum of ly into a macro var --*;
> %local ly;
> proc sql noprint;
> select put(max(level),best.-l) into :ly
> from morty;
> quit;
> %*-- check --*;
> %put ly=&ly.;
>
> %*-- branch on &ly. --*;
> %if &ly. > 2 %then %do;
> %caseA
> %end; %else %do;
> %caseB
> %end;
>
> %mend driver;
>
> %driver
> /* on log
> ly=2
> caseB
> */
To: chang_y_chung@HOTMAIL.COM
SAS-L@LISTSERV.UGA.EDU
|