home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / bit / listserv / sasl / 3488 < prev    next >
Encoding:
Text File  |  1992-07-30  |  2.3 KB  |  90 lines

  1. Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
  2. Path: sparky!uunet!paladin.american.edu!auvm!DMRHRZ11.BITNET!SCHICK
  3. Message-ID: <SAS-L%92073016185894@AWIIMC12.IMC.UNIVIE.AC.AT>
  4. Newsgroups: bit.listserv.sas-l
  5. Date:         Thu, 30 Jul 1992 15:10:21 CET
  6. Reply-To:     Arnold Schick <SCHICK@DMRHRZ11.BITNET>
  7. Sender:       "SAS(r) Discussion" <SAS-L@UGA.BITNET>
  8. From:         Arnold Schick <SCHICK@DMRHRZ11.BITNET>
  9. Subject:      calculations within a %MACRO
  10. Lines: 78
  11.  
  12. Hallo ALL,
  13.  
  14. within a %MACRO I have to calculate one value for a variable, which
  15. to find in cases of _N_ = 1,2,3 (see below). Now, I produce test data
  16. for this %MACRO and the %MACRO will work only for one sort of data.
  17.  
  18. With the first sort of data creates it not an ANFANG data set and for the
  19. second sort is it created. I want to locate the conditions for the
  20. unproducing and can't find it (pherhaps too long looked to ...). Yes I
  21. know, the missings, but the third (_N_=3) should be given out to ANFANG
  22. in both situations.
  23.  
  24. The platform and/or version of SAS is not the cause.
  25.  
  26. Has everyone an idea, why it runs on this different ways?  Many Thanks.
  27.  
  28.  
  29. Arnold Schick  University of Marburg/Germany BITNET: SCHICK@DMRHRZ11
  30.                                      Internet: Schick@ibm.hrz.uni-marburg.DE
  31.  
  32. Here is the reduced %MACRO:
  33.  
  34.  
  35. %macro kif3d (data,x,y,z);
  36.   /* ..... */
  37.  
  38.   data _NULL_ ;
  39.     set &data;
  40.     &y = fuzz(&y);
  41.     if _N_ = 1 then call symput('y_1',&y);
  42.     if _N_ = 2 then call symput('y_2',&y);
  43.     if _N_ = 3 then do; call symput('y_3',&y); stop; end;
  44.   run;
  45.  
  46.   data anfang(keep= &x dz_start);
  47.      set &data;
  48.      &y = fuzz(&y);
  49.      &z = fuzz(&z);
  50.      y1 = lag(&y);
  51.      z1 = lag(&z);
  52.      if (&y=&y_2) or (&y=&y_3) then do;
  53.             dz   = (&z - z1)/(&y - y1);
  54.             dz_b = lag(dz);
  55.             if &y=&y_3 then do;
  56.                dz_start = 2*dz_b - dz;
  57.                output anfang;
  58.             end;
  59.      end;
  60.   run;
  61.  
  62.   /*....*/
  63. %mend kif3d;
  64.  
  65. data eins;
  66.   do x=-8*atan(1) to 8*atan(1) by 0.8 ;
  67.      do y=-8*atan(1) to 8*atan(1) by 0.8 ;
  68.         z=sin(sqrt(x*x + y*y));
  69.         output;
  70.      end;
  71.   end;
  72. run;
  73.  
  74. %kif3d (eins, x, y, z);
  75.  
  76. proc print data=anfang; run;
  77.  
  78. data eins;
  79.   do x=-5 to 8*atan(1) by 0.8 ;
  80.      do y=-5 to 8*atan(1) by 0.8 ;
  81.         z=sin(sqrt(x*x + y*y));
  82.         output;
  83.      end;
  84.   end;
  85. run;
  86.  
  87. %kif3d (eins, x, y, z);
  88.  
  89. proc print data=anfang; run;
  90.