Date: Fri, 27 Feb 2004 15:40:37 -0500
Reply-To: "Fehd, Ronald J. (PHPPO)" <rjf2@CDC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Fehd, Ronald J. (PHPPO)" <rjf2@CDC.GOV>
Subject: Re: Counter
Content-Type: text/plain; charset="iso-8859-1"
> From: Pascale Beaupré [mailto:Pascale.Beaupre@STATCAN.CA]
> Trying tio create a counter... where TOT_ADOPT would add up
> each time CHDTYPi = "2" . With this code (below), TOT_ADOPT
> stays at 0. Can someone please help me out in finding what I
> am doing wrong/ forgetting ? Thank you ! Have a nice day !!
Your code looks correct.
You may wish to rotate your data using proc transpose
then do a frequency of CHDTYP
to see what values you do indeed have in your array.
I would do a Contents of MAIN2
to see that your ChdTyp* variable are $char1.
Ron Fehd the data detective
or macro maven CDC Atlanta GA USA RJF2@cdc.gov
remember perspective: the error is not always where it seems to occur! -- RJF2
> DATA TEMP1;
> SET MAIN2;
>
> ARRAY TYPCHD {15} $1 CHDTYP1 CHDTYP2 CHDTYP3 CHDTYP4 CHDTYP5
> CHDTYP6 CHDTYP7
> CHDTYP8 CHDTYP9 CHDTYP10 CHDTYP11
> CHDTYP12 CHDTYP13
> CHDTYP14 CHDTYP15;
>
> RETAIN TOT_ADOPT 0;
>
> DO i = 1 to 15;
> IF TYPCHD (I) IN ("2") THEN TOT_ADOPT + 1;
> END;
>
> RUN;
>