Date: Wed, 8 Mar 2000 16:37:39 +0100
Reply-To: detecsm_hellriegelg@WESTLB.DE
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Gehard Hellriegel <detecsm_hellriegelg@WESTLB.DE>
Subject: Re: Q array prob and also Tutorial
Content-type: multipart/mixed;
Boundary="0__=iFjP0zSS8nicT0779RuD9oh14i6KqnmXJQFqUuq7BBiOcZ9WBLyHT06S"
Hi Mark,
of course, you are right! But this is the best example, that sometimes it
doesn't help, looking at the log! In the log you will NOT find
something about this LOGICAL error. You can only discover syntax-errors there,
but sometimes (like in this case) the syntax is ok,
but the results are garbage or at least something you did not want!
In this case you have to prove your logic and this is NOT related to SAS or any
other code. You can use each programming
language to produce wrong results!
Maybe there is a problem with finding such things. Very often the developer of
some code is NOT able to see typos or some errors,
but another person, who doesn't know what the developer wanted to do with his
code will find it quick! I think, the best idea is, like
Christian did, to put it here in the list, so some people can look at the code
and possibly find a quick solution.
Mark Moran <Mark.K.Moran@CCMAIL.CENSUS.GOV> on 08.03.2000 15:56:33
Bitte antworten an Mark.K.Moran@CCMAIL.CENSUS.GOV
An: SAS-L@LISTSERV.UGA.EDU
Kopie: (Blindkopie: DeTeCSM HellriegelG/D/ExternalStaff/WLB)
Thema: Re: Q array prob and also Tutorial
Jim's response, below, to Christian brought to mind a general comment. Do you
know what some of us SAS users who have not quite thoroughly mastered the
SAS language could use? It would be helpful if either SAS-L or the SAS
Institute
could provide a tutorial on reading errors and warnings in the LOG. In some
cases,
I have spent literally hours pouring over errors in the LOG, only then showed
the
LOG to someone more experienced with SAS than I and had them point out the
problem in a minute or less. I have always wanted to be able to do that, but
people have
not seemed interested so far in educating those of us less enlightened. I think
there is
more than simply raw experience going on here, there is also some degree of
skill,
because some SAS Users catch on to reading the LOG much faster than others.
IMHO, this tutorial would be very productive for a lot of SAS users of all
levels and
skills.
Mark
Jim Groeneveld <J.Groeneveld@ITGROUPS.COM> on 03/08/2000 08:27:53 AM
Please respond to Jim Groeneveld <J.Groeneveld@ITGROUPS.COM>
To: SAS-L@LISTSERV.VT.EDU
cc: (bcc: Mark K Moran/CSD/HQ/BOC)
Subject: Re: Q array prob: numer of vars > 10
Christian,
This just concerns a typing error of yours. Look at your code carefully.
Don't you see anything peculiar? Correct, in array declaration f2 var210
should be var29 (or var30). Below array f2 includes array f3, that is why.
And the frequency for a var30=1 apparently is 0, so it does not occur; I
think var30 does not exist. Am I right?
Regards - Jim.
--
Y. (Jim) Groeneveld, MSc IMRO TRAMARKO tel. +31 412 407 070
senior statistician, P.O. Box 1 fax. +31 412 407 080
head IT department 5350 AA BERGHEM IMRO TRAMARKO: a CRO
J.Groeneveld@ITGroups.com the Netherlands in clinical research
My computer seems more
²°°°-compatible than I am myself.
> -----Original Message-----
> From: Christian F.G. Schendera [SMTP:schendera@NIKOCITY.DE]
> Sent: Tuesday, March 07, 2000 6:51 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Q array prob: numer of vars > 10
>
> I have an array prob. Code runs fine for arrays with vars < 10 (see vars
> FRAGE1 and FRAGE3). At FRAGE2 the array misses category 10 and instead
> runs
> on into the vars of FRAGE3 (see output below). How could I stop SAS from
> doing this?
> Best, Chris
>
>
> data TEST2 (keep = FBNr frage1 frage2 frage3 ) ;
> set TEST ;
> array newvars(*) FRAGE1 FRAGE2 FRAGE3 ;
> array f1(*) var11-var14 ;
> array f2(*) var21-var210 ;
> array f3(*) var31-var37 ;
>
> do i = 1 to dim(newvars) ;
> newvars(i) = . ;
> end ; * set all to missing ;
> do i = 1 to dim(f1) ;
> if f1(i) = 1 then do ;
> FRAGE1 = i ;
> output ;
> end ;
> end ;
>
> do i = 1 to dim(newvars) ;
> newvars(i) = . ;
> end ; * set all to missing ;
> do i = 1 to dim(f2) ;
> if f2(i) = 1 then do ;
> FRAGE2 = i ;
> output ;
> end ;
> end ;
>
> do i = 1 to dim(newvars) ;
> newvars(i) = . ;
> end ; * set all to missing ;
> do i = 1 to dim(f3) ;
> if f3(i) = 1 then do ;
> FRAGE3 = i ;
> output ;
> end ;
> end ;
> run ;
>
> Cumulative Cumulative
> FRAGE2 Frequency Percent Frequency Percent
> ffffffffffffffffffffffffffffffffffffffffffffffffffff
> 1 49 5.2 49 5.2
> 2 57 6.0 106 11.2
> 3 47 5.0 153 16.2
> 4 18 1.9 171 18.1
> 5 25 2.6 196 20.7
> 6 18 1.9 214 22.6
> 7 1 0.1 215 22.7
> 8 2 0.2 217 22.9
> 9 27 2.9 244 25.8
> data of FRAGE3! -> 11 58 6.1 302
> 31.9
> data of FRAGE3!-> 12 37 3.9 339
> 35.8
> data of FRAGE3!-> 13 34 3.6 373
> 39.4
> data of FRAGE3!-> 14 28 3.0 401
> 42.4
>
>
> FRAGE3 Frequency Percent Frequency Percent
> ffffffffffffffffffffffffffffffffffffffffffffffffffff
> 1 58 33.7 58 33.7
> 2 37 21.5 95 55.2
> 3 34 19.8 129 75.0
> 4 28 16.3 157 91.3
> 5 1 0.6 158 91.9
> 6 12 7.0 170 98.8
Mit freundlichen Gruessen
DeTeCSM, Gerhard Hellriegel
WestLB
Abteilung: 001-80622
Aderstr. 22
D - 40217 Duesseldorf
Tel.: +49211 826 6173
Fax: +49211 826 5393