Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!psuvax1!psuvm!VCUVAX!HAMER From: HAMER@VCUVAX.BITNET (ROBERT M. HAMER) Newsgroups: bit.listserv.sas-l Subject: Re: squaring std's in a type=cov data set Message-ID: Date: 8 Feb 90 21:10:00 GMT Sender: "SAS(r) Discussion" Reply-To: "ROBERT M. HAMER" Lines: 23 Approved: NETNEWS@PSUVM Gateway Original_To: NET%"alderton@nprdc.navy.mil" Original_cc: BITNET%"sas-l@vtvm1" writes: > I posted a note yesterday about squaring the _numeric_ values of >a _type_='std' in a type=cov data set. A few suggestions were made but >most people asked me for more information. Below is the code is I >working with. I need 4 quantities: (a) the sum of all the elements >in the covariance matrix (sumc below), (b) number of subjects in the >data set (n below), (c) the number of items entering into the covariance >set (k below), and (d) the sum of the variances (sumv below). I can get >the first three quantities but haven't been successful getting the sum >of the variances. More accurately, I cannot get the standard deviations I am still not at all sure I understand what you want, because your ends and your means seem to be two different things. You say that want you want is (and I quote exactly) "the sum of the variances." The variances are the diagonal elements of a covariance matrix, so if you want the sum of the variances, you want to go through the covariance matrix, line by line, figure out what line you are on, get to the variable corresponding to that line, pick off the variance, and increment your accumulator. You could use array's for that, but in a very different way from the way you tried to.