|
Chapter Contents |
Previous |
Next |
| File Access |
For example, suppose that you have a matrix X containing data that you want written to the file USER.MATRIX. Suppose also that X contains 1s and 0s so that the format for output can be one column. You need to do the following:
filename out 'user.matrix';
file out;
do i=1 to nrow(x);
do j=1 to ncol(x);
put (x[i,j]) 1.0 +2 @;
end;
put;
end;
closefile out;
The output file contains a record for each row of the matrix.
For example, if your matrix is 4 ×4,
then the file might look as follows:
1 1 0 1 1 0 0 1 1 1 1 0 0 1 0 1
> file print; > do a=0 to 6.28 by .2; > x=sin(a); > p=(x+1)#30; > put @1 a 6.4 +p x 8.4; > end;The result is shown below:
0.0000 0.0000 0.2000 0.1987 0.4000 0.3894 0.6000 0.5646 0.8000 0.7174 1.0000 0.8415 1.2000 0.9320 1.4000 0.9854 1.6000 0.9996 1.8000 0.9738 2.0000 0.9093 2.2000 0.8085 2.4000 0.6755 2.6000 0.5155 2.8000 0.3350 3.0000 0.1411 3.2000 -0.0584 3.4000 -0.2555 3.6000 -0.4425 3.8000 -0.6119 4.0000 -0.7568 4.2000 -0.8716 4.4000 -0.9516 4.6000 -0.9937 4.8000 -0.9962 5.0000 -0.9589 5.2000 -0.8835 5.4000 -0.7728 5.6000 -0.6313 5.8000 -0.4646 6.0000 -0.2794 6.2000 -0.0831
|
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.