everyone. I'm currently using SAS. Here's my situation.
I have a table called 'a', which looks like:
id_c id_t
5 3
2 9
15 1
65 43
... ...
This,a, table has only two different ids from other tables. These 5&3, 2&9,... are pairs.
What I want to do is that I want to take out each id_t and id_c so that I can merge other variables in other tables, respectively. To do so, first I decide to take out id_t and merge other variables. This following code works:
proc sql;
create table t1 as
select *
from other_var_table_1
where id_t in (select id_t from a);
quit;
The result is:
id_t var1 var2 var3
3
9
1
43
Here, the order of id_t is exactly the same as the order of id_t in table 'a'.
However, when I do the same thing by using id_c, the order is messed up. I want:
id_c var_x var_y var_z
5
2
15
65
but when I run the same code, the result becomes such as:
proc sql;
create table t2 as
select *
from other_var_table_2
where id_c in (select id_c from a);
quit;
id_c var_x var_y var_z
65
15
5
2
The purpose of doing this is to merge the two tables again including all the variables such as:
data final;
set t2;
set t1;
run;
id_c var_x var_y var_z id_t var1 var2 var3
5 3
2 9
15 1
65 43
... ...
It would be greatly appreciated if someone could help me out.
Thank you,