Hi Fay,

I think you might be much better off using PROC IML for what you're trying
to accomplish.  If you are interested in getting an external data set into
an IML matrix, one simple way to do this is:

data x;
infile 'c:\imp1.txt';
input x1 x2;

proc iml;

use x;
read all var {x1 x2} into x;

run; 

If after manipulating the matrix, you want to submit it to a different proc
(say to do EM), you could do something like this:

proc iml;

x = {1 1 1,
     2 2 2,
     3 3 3};

create dat from x[colname = {x1 x2 x3}];
append from x;

proc means data = dat;
var x1 x2 x3;

run;

If you're interesting in being able to refer to specific array elements,
that seems like the way to go.  If it would help, contact me directly and I
can give you IML code I used for a couple recent missing data simulations.
They aren't exactly what you need, but you can probably alter snipets of the
code to fit your study.

Hope this helps,
Craig Enders

-----Original Message-----
From: Fay Hughes
To: [email protected]
Sent: 1/22/2003 12:22 AM
Subject: IMPUTE: SAS help required

Hi,

I am trying to programme several simple imputation techniques (namely
unconditional and conditional mean imputation, Healy-Westmacott
procedure, Buck's 1960 method as well as regression based methdos) as
well as using SAS to do EM and DA. My problem is that I want to read in
a completely observed data set and then randomly remove values, and then
use the dataset created for analyses. The way I am thinking of
programming requires my data set to be in an array format so that I can
work with the entire thing, individual values or columns by specifying
things like data, data[1,2] and data[1,*]. I amn having problems getting
SAS (see code below) to create arrays - any help on this problem,
possible SAS codes or places to look on the web for help would all be
appreciated.

Many thanks
Fay Hughes
Statistics masters student
University of Natal, Durban

SAS code (randomly removes values, but does not put the remaining ones
into an array)

data try;
 input Oxygen RunTime RunPulse @@;
 array try2(3,1) Oxygen RunTime RunPulse;
 DO cols = 1 to 3;
     DO rows = 1 to 1;
            x=rand('uniform');
            if (x<0.1) then try2(cols,rows)= 0;
        end;
  end;
 datalines;
 44.609  11.37  178
 39.442  13.08  174
 45.313  10.07  185
 60.055   8.63  170
 51.855  10.33  166
 49.156   8.95  180
 39.407  12.63  174
 46.080  11.17  156
 45.790  10.47  186
 50.545   9.93  148
 48.673   9.40  186
 47.920  11.50  170
 47.467  10.50  170
 ;


Reply via email to