Date: Wed, 8 Mar 2000 02:22:14 +0100
Reply-To: "Christian F.G. Schendera" <schendera@NIKOCITY.DE>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Christian F.G. Schendera" <schendera@NIKOCITY.DE>
Subject: Q ARRAY prob (skipping vars)
Content-Type: text/plain; charset="iso-8859-1"
Hi there,
array strikes again. this time it's no oversight, but a straightforward 'I
don't know how to do it'. I want to compute means and I need to add a class
var only for every second var with an -2 ending (except var1912).
Every -2-var (except var1912) should build a class. The means should be
computable later by these classes.
I've prepared code to aplay round with. I have no clue how to add a class
var for every second -2-var
at the same time. Brute force solutions and aesthetic codings equally
welcome.
All the best, Chris
data TEST ;
input
var1911 var1912 var1921 var1922 var1931 var1932
var1941 var1942 var1951 var1952 var1961 var1962
var1971
var1972 var1981 var1982 var1991 var1992 var19101
var19102
var19111 var19112 var1912 ;
cards;
1 39 1 23 1 34 ...
; run ;
data TEST2 (keep = FRAGE19m ) ;
set GREN1619 ;
array newvars(*) FRAGE19m ;
array f1(*) var1912 var1922 var1932 var1942 var1952 var1962
var1972 var1982 var1992
var19102 var19112 ;
do i = 1 to dim(newvars) ;
newvars(i) = . ;
end ; * set all to missing ;
do i = 1 to dim(f1) ;
if f1(i) = 1 then do ;
FRAGE19f = i ;
output ;
end ;
end ;
run ;
|