Date: Fri, 7 Jul 2000 00:32:30 +0200
Reply-To: Benno Burkhart <Benno.Burkhart@GMX.DE>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Benno Burkhart <Benno.Burkhart@GMX.DE>
Organization: T-Online
Subject: Re: Seek for Advice
Content-Type: text/plain; charset=ISO-8859-1
Hello Jing,
I think I would make it so:
data WKDATA;
infile cards dlm = '#';
input StudID Engl EnglAvg EnglHigh Math mathAvg mathHigh Musi musiAvg
musiHigh draw drawAvg drawHigh;
cards;
01#90#80#95#76#80#100#90#75#97#60#86#98#
02#78#80#96#97#80#100#80#88#98#76#75#99#
03#85#80#96#80#75# 98#87#84#95#82#80#100#
04#70#90#99#60#86# 99#65#76#99#65#80#98#
;
run;
%macro BLA;
options mprint;
%let ALLEFACH = ENGL MATH MUSI DRAW;
%let FACHANZ = 4;
data WKDATA (keep = STUDID RANGE GRADE NOTICE);
set WKDATA;
length RANGE $7;
format STUDID z2.;
%do I = 1 %to &FACHANZ.;
%let FACH = %scan (&ALLEFACH., &I.);
if &FACH. < &FACH.AVG then do;
GRADE = &FACH.;
NOTICE = "&FACH.";
RANGE = compress (put (&FACH.AVG, 8.) !! '--' !! put
(&FACH.HIGH, 8.));
output;
end;
%end;
run;
proc print; run;
%mend BLA;
%BLA
/* Saludos de Benno */
"Jing Liu" <mengq99@HOTMAIL.COM> schrieb im Newsbeitrag
news:20000706212956.91436.qmail@hotmail.com...
> Suppose I have following data: SDD1, consiste of students' grades and
> average and high grads on several courses.
>
> StudID Engl eAvg eHigh Math mAvg mHigh Music mAvg mHigh draw dAvg dHi
> 01 90 80 95 76 80 100 90 75 97 60 86 98
> 02 78 80 96 97 80 100 80 88 98 76 75 99
> 03 85 80 96 80 75 98 87 84 95 82 80 100
> 04 70 90 99 60 86 99 65 76 99 65 80 98
> ...
>
> What I want to do is to find student's grade which is not between the
> average and the high. For above example, following will be the expected
> output:
>
> StudId Notice grade Range
> 01 Math 76 80--100
> draw 60 86--98
> 02 english 78 80--96
> music 80 88-98
> 04 english 70 90--99
> math 60 86--99
> music 65 76--99
> draw 65 80--98
>
> Can any expert advise what will be the best way to make this? I tried to
use
> array and several other methods, it needs several steps and I don't think
it
> is the most efficient one. I bet you experts have better solution for
this.
> Any suggestion is appreciated in advance.
>
> Best Wish
>
> Jing
>
>
>
> ________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com