```Date: Wed, 21 Jul 2004 07:21:37 -0700 Reply-To: "G.McMillan" Sender: "SAS(r) Discussion" From: "G.McMillan" Organization: http://groups.google.com Subject: Re: A simpler way? Content-Type: text/plain; charset=ISO-8859-1 How about: array pgr {6} p1grnum p2grnum... p6grnum; array pgrnew {6} pg1-pg6; do i = 1 to 6; if pgr[i] < 4 then pgrnew[i] = .; else pgrnew[i] = pgr[i]; end; preq = mean(of pg1-pg6); anpam@UAA.ALASKA.EDU (Pat Moore) wrote in message news:<200407210050.i6L0o8h16583@listserv.cc.uga.edu>... > I have variables p1grnum--p6grnum that each vary from 0-8. I wrote this > code: > > /*this makes grnums below 4 negative numbers*/ > p1g=p1grnum-4; > p2g=p2grnum-4; > p3g=p3grnum-4; > p4g=p4grnum-4; > p5g=p5grnum-4; > p6g=p6grnum-4; > /*this sets negative values of p1g-p6g to missing so non-letter grades are > not computed into the gpa*/ > if p1g<0 then p1g=.; > if p2g<0 then p2g=.; > if p3g<0 then p3g=.; > if p4g<0 then p4g=.; > if p5g<0 then p5g=.; > if p6g<0 then p6g=.; > /*this computes the grade point average with the modified values*/ > preqgpa=mean(p1g,p2g,p3g,p4g,p5g,p6g); > > Is there some more sophisticated way to do this? ```

Back to: Top of message | Previous page | Main SAS-L page