X-Mailer: ELM [version 2.2 PL11]
Newsgroups: bit.listserv.sas-l
Date:         Sat, 22 Aug 1992 10:33:44 EST
Reply-To:     "D. Glen McPherson" <mcphers@HILBERT.MATHS.UTAS.EDU.AU>
From:         "D. Glen McPherson" <mcphers@HILBERT.MATHS.UTAS.EDU.AU>
Subject:      array declaration

                PROBLEM WITH ARRAY DECLARATION

The following extract is from a log file of a SAS 6.04 program run on
a PC. I believe that I have defined an array of character variables.
When I try to assign character values, SAS objects.
I have annotated the points of difficulty. (The annotations were added
after the program was run.)
If anyone can point to my error and what I should do to correct it, I
will be most appreciative.

Thanks,  Glen.

                         ANNOTATED EXTRACT FROM LOG FILE

  925
  947
  948    data whinam.clarence;
  949      set whinam.clarence;
  950      array g{7} gain1-gain7;
  951      array num{8} Oct_88--Mar_92;
  952      array s{7} gsign1-gsign7;
  953      array ss{7} $ sign1-sign7;   *** declare array  ss  of
                                        *** character variables;
  954      array snum{7} sn1-sn7;
  955
  956      do i = 1 to 7;
  957         if num{i} = . or num{i+1} = . then g{i} = .;
  958            else g{i} = num{i+1} - num{i};
  959         s{i} = sign(g{i});
  960         if s{i} eq -1 then ss{i} = '-';
  961            else if s{i} eq +1 then ss{i} = '+';
  962            else ss{i} = ' ';
                                      *** SAS objects to ss{i} being
                                      *** assigned character values Why?
                                      *** (see errors listed below);
  963         if s{i} eq -1 or s{i} eq +1 then snum{i} = 1;
  964            else snum{i} = 0;
  965       end;
  966
  967       nsign = sum(of sn1-sn7);
  968       if nsign eq 0 then nsign = .;
  969
  970      sdif = sum(of gsign1-gsign7)/nsign;
  971
  972    proc print data=whinam.clarence(obs=3);
NOTE: Invalid numeric data, '+' , at line 961 column 41.
NOTE: Invalid numeric data, '-' , at line 960 column 33.
NOTE: Invalid numeric data, '+' , at line 961 column 41.
NOTE: Invalid numeric data, '+' , at line 961 column 41.
NOTE: Invalid numeric data, '+' , at line 961 column 41.
NOTE: Invalid numeric data, '+' , at line 961 column 41.
NOTE: Invalid numeric data, '+' , at line 961 column 41.
TREAT=B PLOT=1 SPECIES=Gleichen LIFEFORM=F OCT_88=22.5 DEC_88=30 SEP_89=20
FEB_90=25 NOV_90=32.5 MAR_91=40 NOV_91=50 MAR_92=85 GAIN1=7.5 GAIN2=-10
GAIN3=5 GAIN4=7.5 GAIN5=7.5 GAIN6=10 GAIN7=35 GSIGN1=1 GSIGN2=-1 GSIGN3=1
GSIGN4=1 GSIGN5=1 GSIGN6=1 GSIGN7=1 I=8 NSIGN=7 SDIF=0.7142857143 SN1=1
SN2=1 SN3=1 SN4=1 SN5=1 SN6=1 SN7=1 SIGN1=* SIGN2=* SIGN3=* SIGN4=* SIGN5=*
SIGN6=* SIGN7=* _ERROR_=1 _N_=1
--
 ---------------------------------------------------------------------------
|  Glen McPherson            |                                   |  _--_|\  |
|  Department of Mathematics |-----------------------------------| /      \ |
|  University of Tasmania    |               E-Mail:             | \_.--._/ |
|  Australia.                | mcphers@hilbert.maths.utas.edu.au |       *  |
 ---------------------------------------------------------------------------
Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU