home *** CD-ROM | disk | FTP | other *** search
- Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
- Path: sparky!uunet!paladin.american.edu!auvm!DMRHRZ11.BITNET!SCHICK
- Message-ID: <SAS-L%92073016185894@AWIIMC12.IMC.UNIVIE.AC.AT>
- Newsgroups: bit.listserv.sas-l
- Date: Thu, 30 Jul 1992 15:10:21 CET
- Reply-To: Arnold Schick <SCHICK@DMRHRZ11.BITNET>
- Sender: "SAS(r) Discussion" <SAS-L@UGA.BITNET>
- From: Arnold Schick <SCHICK@DMRHRZ11.BITNET>
- Subject: calculations within a %MACRO
- Lines: 78
-
- Hallo ALL,
-
- within a %MACRO I have to calculate one value for a variable, which
- to find in cases of _N_ = 1,2,3 (see below). Now, I produce test data
- for this %MACRO and the %MACRO will work only for one sort of data.
-
- With the first sort of data creates it not an ANFANG data set and for the
- second sort is it created. I want to locate the conditions for the
- unproducing and can't find it (pherhaps too long looked to ...). Yes I
- know, the missings, but the third (_N_=3) should be given out to ANFANG
- in both situations.
-
- The platform and/or version of SAS is not the cause.
-
- Has everyone an idea, why it runs on this different ways? Many Thanks.
-
-
- Arnold Schick University of Marburg/Germany BITNET: SCHICK@DMRHRZ11
- Internet: Schick@ibm.hrz.uni-marburg.DE
-
- Here is the reduced %MACRO:
-
-
- %macro kif3d (data,x,y,z);
- /* ..... */
-
- data _NULL_ ;
- set &data;
- &y = fuzz(&y);
- if _N_ = 1 then call symput('y_1',&y);
- if _N_ = 2 then call symput('y_2',&y);
- if _N_ = 3 then do; call symput('y_3',&y); stop; end;
- run;
-
- data anfang(keep= &x dz_start);
- set &data;
- &y = fuzz(&y);
- &z = fuzz(&z);
- y1 = lag(&y);
- z1 = lag(&z);
- if (&y=&y_2) or (&y=&y_3) then do;
- dz = (&z - z1)/(&y - y1);
- dz_b = lag(dz);
- if &y=&y_3 then do;
- dz_start = 2*dz_b - dz;
- output anfang;
- end;
- end;
- run;
-
- /*....*/
- %mend kif3d;
-
- data eins;
- do x=-8*atan(1) to 8*atan(1) by 0.8 ;
- do y=-8*atan(1) to 8*atan(1) by 0.8 ;
- z=sin(sqrt(x*x + y*y));
- output;
- end;
- end;
- run;
-
- %kif3d (eins, x, y, z);
-
- proc print data=anfang; run;
-
- data eins;
- do x=-5 to 8*atan(1) by 0.8 ;
- do y=-5 to 8*atan(1) by 0.8 ;
- z=sin(sqrt(x*x + y*y));
- output;
- end;
- end;
- run;
-
- %kif3d (eins, x, y, z);
-
- proc print data=anfang; run;
-