|
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 ;)
>
>
>
>
>
>
|