| Date: | Tue, 7 Oct 2003 15:18:44 +0200 |
| Reply-To: | "Groeneveld, Jim" <jim.groeneveld@VITATRON.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | "Groeneveld, Jim" <jim.groeneveld@VITATRON.COM> |
| Subject: | Re: Sorting by group |
|
| Content-Type: | text/plain; charset="iso-8859-1" |
Hi Graeme,
Sorry, correction!!!
All right, and I assume you want the records with the matching _CPK_ value just before those (or doesn't that matter?). Well I did not test it, but how about sorting in several steps:
PROC SORT DATA=olddata (WHERE=(_NAME_ EQ '_CP_'))
OUT=intermed (KEEP=_VAR_); BY _COL1_; RUN;
DATA ordered; SET intermed; ordernum=_N_; RUN;
PROC SORT DATA=olddata OUT=solddata; BY _VAR_; RUN; * if this order is not already actual;
PROC SORT DATA=ordered OUT=ordering; BY _VAR_; RUN;
DATA combined; MERGE solddata ordering; BY _VAR_; RUN; /* correction in this line!!! */
PROC SORT DATA=combined OUT=newdata (DROP=ordernum); BY _NAME_ ordernum; RUN;
I hope this works as desired for you. Maybe this can even be simplified, maybe you'll see a shorter, quicker solution yourself. Good luck.
Regards - Jim.
P.S. how about renaming your variables _VAR_, _NAME_, _LABEL_, COL1 somewhere as soon as possible in order to avoid possible variable name collisions?
Y. (Jim) Groeneveld MSc
Biostatistician
Vitatron B.V.
Meander 1051
6825 MJ Arnhem
The Netherlands
+31/0 26 376 7365; fax 7305
Jim.Groeneveld@Vitatron.com
www.vitatron.com
-----Original Message-----
From: Graeme.Kirton@filcs.com [mailto:Graeme.Kirton@filcs.com]
Sent: Tuesday, October 07, 2003 14:47
To: SAS-L@LISTSERV.UGA.EDU
Cc: Groeneveld, Jim
Subject: Sorting by group
Hi again, sorry I havn't made myself clear.
Im plotting some vbar charts and I want my graphs to show the smallest _cp_
value the leftmost and work upto the biggest.
I ask to reorder my original dataset because when I manually organise the
data it makes it correct.
my code;
proc gchart data=stock3 gout=mapout;
vbar _NAME_ /
subgroup=_NAME_ group=_VAR_ type=SUM sumvar=COL1 maxis=axis1
discrete frame cframe=CXFFFFFF
woutline=1 coutline=CX000000 caxis=CX000000
raxis=axis2 legend=legend1 group=_VAR_ G100 subgroup=_VAR_;
run;
quit;
--------------------------------------------------------------
Graeme Kirton
IT Developer
Filtronic Compound Semiconductors Ltd
01325 306094
"IMPORTANT NOTICE
This email may contain confidential information and will be protected by
copyright.
It is intended only for the use of the person(s) to whom it is addressed
and any unauthorised
use (including forwarding or dissemination the contents) may be unlawful.
If you receive this email by mistake, please advise the sender immediately
by using the reply facility on
your email software and delete the email from your computer.
Opinions, conclusions and other information in this email that do not
relate to the official business
of this organisation shall be understood as neither given nor endorsed by
it.
If this message forms part of a quotation for the supply of goods, the
quotation is an invitation to treat only. No contract will come into
effect until the Company issuing such quotation (or Filtronic plc or one of
its subsidiaries on its behalf) issues an acknowledgment of order for the
supply of such goods. The contract will be on the terms of such
acknowledgment of order.
Website address: http://www.filtronic.com"
|