Date: Sun, 18 Dec 2005 16:25:22 -0800
Reply-To: Jason Shen <jason80115@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jason Shen <jason80115@YAHOO.COM>
Subject: Need help on a simple data manipulation question
Content-Type: text/plain; charset=iso-8859-1
Hi,
I need help on a simple data manipulation question. For example, I have the following data set.
data test;
input x y1 y2 y3 y4 y5;
cards;
1 3 * 5 90 9
1 2 * 9 10 *
1 2 * 8 8 6
2 1 3 * 8 10
2 3 8 * * 9
2 4 2 * 9 3
3 9 2 9 4 *
3 8 1 2 5 *
;
If any one of variables y1-y5 does not have any non-missing values for each value of x, this variables should be removed from the dataset. So in this case, y2 is all missing for x=1; y3 is all missing for x=2 and y5 is all missing for x=3. I want to remove variables y2, y3 and y5 from the data set. Since I actually have 50 variables in my real data, I want to know how to write the code to remove the variables I don't want.
the final data shoud look like this:
1 3 90
1 2 10
1 2 8
2 1 8
2 3 *
2 4 9
3 9 4
3 8 5
Thanks a lot.
Jason
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
|