Header 1 | Header 2 | Header 3 |
---|---|---|
1 | ||
0.2 | 1 | |
0.5 | 0.9 | 1 |
0.8 | 0 | 0.28 |
So I have something like this but it's a very big one (100K*100K).
Header 1 | Header 2 | Header 3 |
---|---|---|
1 | 0.2 | 0.5 |
0.2 | 1 | 0.9 |
0.5 | 0.9 | 1 |
I hope to get the spces all filled up with a correlation or simmilarity whatever becomes
I know proc iml can do this quickly but my sas just doesn't have proc iml comes with it.
Please let me know anyway I can solve the problem.
I aprpeciate!!
-Sarah
100k variables is a lot! This works for 10,000 variables and doesn't take too long. I tried it with 100,000 but did not want to wait for it to finish.
This method is simple flip the data over, so that you get an upper trianglar. Then update the lower with the upper. Requires an observation index variable (_obs_).
100k variables is a lot! This works for 10,000 variables and doesn't take too long. I tried it with 100,000 but did not want to wait for it to finish.
This method is simple flip the data over, so that you get an upper trianglar. Then update the lower with the upper. Requires an observation index variable (_obs_).
I do not think a 100k X 100k matrix will be possible to do this way, I think it tops out somewhere above 16k X 16k. Not sure if this is some limit on FCMP.
proc fcmp;
array x[10000,10000] /nosymbols;
t=time();
/* fill lower triangle */
do a=1 to 10000;
do b=1 to a;
x[a,b]=1 ++ a +- b ;
end;
end;
d=time()-t;
put 'fill=' d 'seconds';
t=time();
/* fill upper triangle */
do a=1 to 10000 by 1;
do b=10000 to a by +-1;
x[a,b]=x[b,a];
end;
end;
d=time()-t;
put 'transpose=' d 'seconds';
t=time();
rc=write_array('all',x);
d=time()-t;
put 'write=' d 'seconds';
run;
fill= 1.0461549759 seconds
transpose= 2.3460171223 seconds
write= 7.7724590302 seconds
I appreciate!!!!!!!!!!!!!!!!
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.