Date: Thu, 18 Oct 2007 10:07:46 -0500
Reply-To: Mary <mlhoward@avalon.net>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Mary <mlhoward@AVALON.NET>
Subject: Re: Assignment using min and max
Content-Type: text/plain; charset="iso-8859-1"
C.A.N,
Howard Schreier sent me an improvement on this (I'd also missed the colon on the second SQL statement); I don't see it posted to the list so I'll post it here.
-Mary
This can be streamlined a bunch:
proc sql;
select min(height), max(height)
into : min_height , : max_height
from sashelp.class;
create table ... ;
quit;
2 statements in 1 step rather than 3 in 3; 1 less data pass
----- Original Message -----
From: Mary
To: C.A.N. ; SAS-L@LISTSERV.UGA.EDU
Sent: Wednesday, October 17, 2007 3:28 PM
Subject: Re: Re: Assignment using min and max
My SAS is running at the moment, so this is not tested, but couldn't you do this with macro variables?
proc sql;
select min(variable) into :min_macro_var
from seta;
proc sql;
select max(variable) into max_macro_var
from seta;
proc sql;
create table newb as
select * from setb
where variable >= &min_macro_var and
variable <= &max_macro_var;
-Mary
----- Original Message -----
From: C.A.N.
To: SAS-L@LISTSERV.UGA.EDU
Sent: Wednesday, October 17, 2007 3:09 PM
Subject: Re: Assignment using min and max
On Oct 17, 9:56 am, peterflomconsult...@mindspring.com (Peter Flom)
wrote:
> "C.A.N." <healthysh...@YAHOO.COM> wrote
>
>
>
> >Is there a way, other than hard coding the ranges, to assign
> >observations from a data set into groups/clusters based on the min-max
> >output from proc means (based on another data set)?
>
> >Thanks.
>
> I am not quite sure what you mean, here. Tell me if I have the idea
>
> You have two data sets. Each has the same variables, but different observations. You want to find out which observations, in data set B, have the minimum or maximum from data set A, and assign them to groups based on that....
>
> Are these variables continuous or ordinal?
> If continuous, then the max from one data set is unlikely to exactly match the max from the other data set. Or do you want to assign them to a group if they are "close" to the max or min from the other data set?
>
> If you have more than one variable, how do you deal with that?
>
> I'm obviously not fully understanding what you intend - could you explain further?
>
> Thanks
>
> Peter
With data set A, I defined/clustered x groups based on one continuous
variable. The clusters have minimum and maximum values for that
variable. I would look to apply those minimum and maximum values to
assign the observations of another data set with the same varibles
variables to the same groups.