Dear Rick, Thank you for your response! Indeed, some variables had all missing values, which I have now dropped. However, I am still getting the same error. I will post the entire log below: 154 %let DSName = depo.gvanonmiss;
155 proc iml;
NOTE: IML Ready
156 /* SAS/IML module to Winsorize each column of a matrix.
157 Input proportion of observations to Winsorize: prop < 0.5.
158 Ex: y = Winsorize(x, 0.1) computes the two-side 10% Winsorized data */
159 start Winsorize(x, prop);
160 p = ncol(x);
160! /* number of columns */
161 w = x;
161! /* copy of x */
162 do i = 1 to p;
163 z = x[,i];
163! /* copy i_th column */
164 n = countn(z);
164! /* count nonmissing values */
165 k = ceil(prop*n);
165! /* number of obs to trim from each tail */
166 r = rank(z);
166! /* rank values in i_th column */
167 /* find target values and obs with smaller/larger values */
168 lowIdx = loc(r<=k & r^=.);
169 lowVal = z[loc(r=k+1)];
170 highIdx = loc(r>=n-k+1);
171 highVal = z[loc(r=n-k)];
172 /* Winsorize (replace) k smallest and k largest values */
173 w[lowIdx,i] = lowVal;
174 w[highIdx,i] = highVal;
175 end;
176 return(w);
177 finish;
NOTE: Module WINSORIZE defined.
178
179 /* test the algorithm on numerical vars in a data set */
180 use &DSName;
181 read all var _NUM_ into X[colname=varNames];
182 close;
NOTE: Closing DEPO.GVANONMISS
183 winX = Winsorize(X, 0.05);
ERROR: (execution) Matrix has not been set to a value.
operation : [ at line 169 column 17
operands : z, _TEM1003
z 1708 rows 1 col (numeric)
_TEM1003 0 row 0 col (type ?, size 0)
statement : ASSIGN at line 169 column 7
traceback : module WINSORIZE at line 169 column 7
NOTE: Paused in module WINSORIZE.
184
185 create WinData from winX[colname=varNames];
ERROR: Matrix winX has not been set to a value.
statement : CREATE at line 185 column 1
186 append from winX;
ERROR: No data set is currently open for output.
statement : APPEND at line 186 column 1
186! ;
187 close;
188
NOTE: Exiting IML.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE IML used (Total process time):
real time 0.09 seconds
cpu time 0.09 seconds
189 proc means data=WinData;
ERROR: File WORK.WINDATA.DATA does not exist.
190 run;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE MEANS used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds As per my data, there are over 600 variables, so I will post a printscreen of a portion of the summary if that helps: Many thanks for the help!
... View more