Oligolas was kind to provide the following code, handling multiple datasets in a library, and doing the same procedure(s) on each dataset:
data _NULL_;
set sashelp.vtable;
where libname eq upcase('YourLib');
call execute('
PROC SORT data='||strip(libname)||'.'||strip(memname)||' out=tmp;
BY variable_rank variable_continuous;
RUN;
DATA yourPermLib.'||strip(memname)||'_divisions;
SET tmp;
BY variable_rank;
if last.variable_rank;
RUN;
PROC DATASETS lib=work noprint;
delete tmp;
RUN;QUIT;');
run;
Works wonderfully.
Here's now a follow-up question, if I may:
The above code deals with one variable pair -- variable_continuous, and it's rank counterpart, variable_rank.
The follow-up issue is that there are 200 such variable pairs in my dataset. EACH of these continuous, with rank counterpart.
The above code results in the following partial output dataset:
i_20901
i_20902
i_20903
i_20904
i_20905
i_20906
rg7_20901
rg7_20902
rg7_20903
rg7_20904
rg7_20905
rg7_20906
5.2998
0.8653
9.7555
-0.4079
4
6
4
1
15.686
0.4401
6.3543
0.0869
4.3429
-0.1955
6
4
3
3
0
0
1.7026
-0.169
11.5141
-0.7457
6.1116
0.0722
1
2
5
0
1
4
0.6265
0.0777
2.2246
-0.1288
7.4253
-0.2075
0
3
0
2
2
0
5.6289
0.9559
2.0766
-0.3934
9.0273
-0.3257
4
6
0
1
3
0
3.1862
-0.2157
4.8757
-0.0159
11.6997
-0.0549
2
2
2
3
4
2
7.7334
-0.1715
9.3654
-0.1501
14.9105
-0.0166
5
2
4
2
5
2
2.3106
0.3048
6.3218
-0.6706
25.3866
0.011
2
4
3
0
6
3
The above dataset creation run focused on continuous variable i_20905, and the corresponding rank variable rg7_20905.
I'll need to delete all the other variables, using SAS 'keep'. The result would be as follows:
i_20905
rg7_20905
4.3429
0
6.1116
1
7.4253
2
9.0273
3
11.6997
4
14.9105
5
25.3866
6
Each and every variable pair would require it's own unique output file such as that above.
All the files would then be combined using SAS Match-Merging, using rank as the common column.
That would be the final result desired. At least for now.
So, what question am I presently asking?
Simply, Using Oligolas' code above, is there a way to handle all the variables in one go?
If not, I will simply copy-paste x200, changing the specifics on variable for each of the 200 runs. Perhaps that would be the best way anyway. As at least I will be able to understand what's happening.
Thanks!
Nicholas Kormanik
... View more