Date: Fri, 11 Jul 2008 07:57:46 -0400
Reply-To: Nathaniel.Wooding@DOM.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Nat Wooding <Nathaniel.Wooding@DOM.COM>
Subject: Re: Special count
In-Reply-To: <8f6bdb5c-e701-4973-b5de-a98af115af59@c58g2000hsc.googlegroups.com>
Content-Type: text/plain; charset="US-ASCII"
Ash
Here is a slightly different approach.
Data ash (rename = ( x2 = w ));
input X1 $1. x2 X3 X4;
x5 = x3 + x4 = 0 ;* x5 is set to 1 if the sum of x3 and x4 = 0;
cards;
G 7 1 0
A 7 1 0
B 7 0 1
C 7 0 0
D 8 1 0
E 9 0 1
F 10 0 0
run;
proc means noprint;
output out = ash (drop = _: ) sum = x y z ;
var x3 x4 x5;
by w;
run;
proc print;
run;
Nat Wooding
Environmental Specialist III
Dominion, Environmental Biology
4111 Castlewood Rd
Richmond, VA 23234
Phone:804-271-5313, Fax: 804-271-2977
ash007
<RamsamyAshley@GM
AIL.COM> To
Sent by: "SAS(r) SAS-L@LISTSERV.UGA.EDU
Discussion" cc
<SAS-L@LISTSERV.U
GA.EDU> Subject
Special count
07/11/2008 02:29
AM
Please respond to
ash007
<RamsamyAshley@GM
AIL.COM>
Hello everybody,
I have a dataset called TAB1 which is like this :
X1 X2 X3 X4
G 7 1 0
A 7 1 0
B 7 0 1
C 7 0 0
D 8 1 0
E 9 0 1
F 10 0 0
X1 is the key.
And I need the dataset called TAB2 like this :
W X Y Z
7 2 1 1
8 1 0 0
9 0 1 0
10 0 0 1
X represents the number of X2 when X3=1.
Y represents the number of X2 when X4=1.
Z reprensents the number of X2 when X3=X4=0.
How can I program this to obtain the dataset TAB2?
Thanks.
Ash007.
CONFIDENTIALITY NOTICE: This electronic message contains
information which may be legally confidential and/or privileged and
does not in any case represent a firm ENERGY COMMODITY bid or offer
relating thereto which binds the sender without an additional
express written confirmation to that effect. The information is
intended solely for the individual or entity named above and access
by anyone else is unauthorized. If you are not the intended
recipient, any disclosure, copying, distribution, or use of the
contents of this information is prohibited and may be unlawful. If
you have received this electronic transmission in error, please
reply immediately to the sender that you have received the message
in error, and delete it. Thank you.