LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 2009, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 28 Jan 2009 10:17:05 -0600
Reply-To:     Mary <mlhoward@avalon.net>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Mary <mlhoward@AVALON.NET>
Subject:      Re: selecting records
Comments: To: Jeri Ji <jeri_ji@FREDDIEMAC.COM>
Content-Type: text/plain; format=flowed; charset="iso-8859-1";
              reply-type=original

And then you'd do this to actually get the records:

proc sql; create table testsubset as select test.* from test join newtable on test.name=newtable.name and test.month=newtable.month; quit;

-Mary ----- Original Message ----- From: Jeri Ji To: SAS-L@LISTSERV.UGA.EDU Sent: Wednesday, January 28, 2009 10:05 AM Subject: Re: selecting records

Nice! Thanks a lot.

Jeri

"Mary" <mlhoward@avalon.net> 01/28/2009 11:04 AM Please respond to "Mary" <mlhoward@avalon.net>

To "Jeri Ji" <jeri_ji@freddiemac.com>, <SAS-L@LISTSERV.UGA.EDU> cc

Subject Re: selecting records

Jeri,

Sql with a group by can do this:

data test; infile cards; input name $ month $ position $; cards; Mary Jan Officer John Jan Manger John Jan Officer Brent Feb Director ; run;

proc sql; create table newtable as select name, month, count(trim(name) || trim(month)) as count from test group by name, month having count(trim(name) || trim(month)) >= 2; quit;

-Mary ----- Original Message ----- From: Jeri Ji To: SAS-L@LISTSERV.UGA.EDU Sent: Wednesday, January 28, 2009 9:51 AM Subject: selecting records

Hello,

I have four records in a dataset: with Name, month and position:

1 Mary Jan Officer 2 John Jan Manger 3 John Jan Officer 4 Brent Feb Director

And I want to create a dataset with record 2 and 3 in, i.e. if there is a position change for the same person in the same month. What can I do?

Thank you!

Jeri


Back to: Top of message | Previous page | Main SAS-L page