| Date: | Tue, 18 Dec 2007 22:48:59 +0000 |
| Reply-To: | iw1junk@COMCAST.NET |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Ian Whitlock <iw1junk@COMCAST.NET> |
| Subject: | Re: selecting a unique set of data. |
|
Ya,
It isn't enough, that is why I labeled it a difficult problem.
Consider
x y
A001 1
A001 3
A002 1
A002 2
A003 1
A003 2
You have to choose
A001 3
in order to win this one, but you cannot know that until
after you have made the choices for A002 and A003. If you
do it in a DATA step, I think you need all the records
in an array and enough book keeping to back track when you
have made a bad choice, and then to use that bad choice if
it happens to be a bad choice.
In other words, to do it in a DATA step, you need a programmer
like Paul Dorfman.
On the other hand, there was a panel of programmers at the last
SGF that wrote programs to solve SUDOKU puzzles and this seems
to require the same sort of logic.
Ian Whitlock
==============
Date: Tue, 18 Dec 2007 14:23:58 -0500
Reply-To: Ya Huang <ya.huang@AMYLIN.COM>
Sender: "SAS(r) Discussion"
From: Ya Huang <ya.huang@AMYLIN.COM>
Subject: Re: selecting a unique set of data.
Comments: To: Ian Whitlock <iw1junk@COMCAST.NET>
Thanks Ian,
I thought about sorting the data by the number of unique y in each x,
so that, the least number of y group get to pick the y first.
This could be done easily by SQL:
proc sql;
select *,count(distinct y) as ny
from have group by x order
by ny,x,y ;
But then I wasn't sure this is enough, so I didn't post.
<SNIP>
|