I am using the rci option in proc mixed to give me the inverse choleski matrix of each subject used in proc mixed.
So for example if i use subjects 3,5,6,7, and 10 to run the analysis then rci=1 would give me the matrix of the first subject used (in this case subject 3), rci=2 would be the second subject (in this case subject 5), etc,
so in proc mixed when i specify: proc mixed;
model ..... / rci=1 to 5;
repeated ... / ....;
ods output InvCholR(match_all)=data1;
the ods output will create data1,data2,...,data5 which are the 5 matrices. I just want to rename the matrices to coincide with the actual subject numbers (in this case 3,5,6,...)
i found i can use
to rename data1 to data3. now i need to know how to run a macro that would take the data set and rename it. something like;
%macro rename (numb_subj,ind);
do i=1 to numb_subj;
where ind is the index of subject numbers, for this example ind=(3,5,6,7,10)
More elegant than renaming data set would be to solve this issue already on the level of ODS. Not sure if and how this would be done.
The code below should do what you asked for:
data data data1 data2 data3;
create view OldDataSets as
select memname as OldName length=32 format=$32.
where libname='WORK' and memname like 'DATA%' and memtype='DATA'
and input(compress(memname,,'kd'),8.) le countw("&subjectlist", ',')
and not missing(input(compress(memname,,'kd'),8.))
order by memname
filename temp1 temp;
set OldDataSets end=last;
/* file print;*/
if _n_=1 then
put 'proc datasets lib=work nolist nowarn;';
put ' delete ' NewName ';';
put ' change ' OldName ' = ' NewName ';';
You have Patrick's solution, but as an aside to answer one of you questions you have the macro rename. Here it is rewritten to perform the renames you suggested
%macro rename (numb_subj=,ind=);
%do i=1 %to &numb_subj;
Where the macro call becomes something like:
%rename(numb_subj=5,ind=2 3 5 7 9)
notice that the DO loop is now %DO and I have changed the statements a bit.
HOWEVER there could be overlaps in the names as you had them so I have added an X to the new name.
Message was edited by: ArtC