Date: Sat, 13 Mar 1999 19:10:15 +0100
Reply-To: "Christian F. G. Schendera" <cschende@IX.URZ.UNI-HEIDELBERG.DE>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: "Christian F. G. Schendera" <cschende@IX.URZ.UNI-HEIDELBERG.DE>
Subject: data manipulation
Content-Type: text/plain; charset="iso-8859-1"
Aaaaaaaaah, sorry for unnecessary confusion!!!!!!!!!!!!
Of course the dataset looks like:
ID VAR1 VAR2 var3 var4 var5.........
01 1 0 1 0 0
02 0 1 0 0 1
03 1 0 0 1 0
.........................................
I will try to be more precise. All colums contain single, and separated
levels of categorial variables (I have changed the example above). The VARs
stand for GENDER (var1, and 2), and US states. That guy infiled e.g. data
for men (var1) and women(var2), but forgot to define the variable GENDER
(having two levels, var1 and var2), or infiled data columes for the singles
US states (say: Arkansas, var3,
Washinton, var4, etc.) but missed to define the var USSTATES (having here 7
levels).
If it would be a input step, it is no problem to write an array
(see code below; this codes produces a categ. var with four levels). What
troubles me is that the data are read in and already a dataset, so rewriting
that code for INPUT or INFILE doesn't work.
DATA SASUSER.KLINIK (KEEP=ID MZP KLINIK);
INPUT ID $ M1-M4;
ARRAY M(4);
DO MZP=1 TO 4;
KLINIK = M(MZP);
OUTPUT;
END;
CARDS;
AG 7 0 0 2
AS 4 0 2 0
MR 3 2 2 3
RN 3 2 0 1
DS 5 2 3 .
;
RUN;
|