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 (February 2003, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 6 Feb 2003 19:36:03 GMT
Reply-To:   julierog@ix.netcom.com
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Roger Lustig <trovato@BELLATLANTIC.NET>
Subject:   Re: Merging datasets ...
Content-Type:   text/plain; charset=us-ascii; format=flowed

Dear Johny:

No merging required! What you need is a format.

Ultimately, you'll just write a short program like this:

data new_num; set numbers; id=put(number,myformat.); *** Or, if you want ID to be numeric: id=input(put(number,myformat.),6.); run;

Now, how to make the MYFORMAT format?

For this you need the following:

proc format cntlin=<data set name>; run;

The data set in question can be generated from the one that contains the FROM and TO variables now. For that, you'll have to read the manual, though--under PROC FORMAT.

Good luck!

Roger

Johny Bravo wrote: > Hi ! > > I have a following problem. > I have two datasets. > First dataset contains numbers, e.g.: > number > 23 > 24 > 435 > 45 > ... > And second dataset that contains intervals, e.g.: > id from to > 1 1 3 > 2 4 23 > 3 26 500 > ... .... .... > > I want to classify all numbers from first dataset > to intervals in the second. I want to have on output > dataset that contains number and an ID of particular > interval, e.g.: > number ID > 23 2 > 24 null > 435 3 > 45 3 > ... ... > ( BTW intervals in second set are separate) > > I am wondering how to do it with data step and maybe "retain". > Maybe If-clause is nessesary, i don't know :( > The main problem is how to join datasets with diffrent number > of observations. > > Thanks in advance for advice, > Best regards, > Johny Bravo ;) > > > > > >


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