Date: Thu, 12 May 2005 11:37:57 -0400
Reply-To: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject: Re: Exclude all missing FD tables
I think the key is to reshape the data into a "long" form, with just three
variables: GROUP, INDEX (ranging from 1 to 5), and V.
Test data:
Data HaHa;
Input group v1 v2 v3 v4 v5 ;
Cards;
1 2 3 4 5 .
1 3 4 5 6 .
2 3 4 . . .
2 . 6 . . .
3 2 . . . .
3 5 . . . .
4 1 1 1 1 1
4 4 5 6 7 8
;
Notice that I've dropped in another missing value, so that there is a case
which contains a mixture of missing and non-missing.
Here's one way to reshape:
data long(keep = group index v);
set haha;
array vv(*) v : ;
do index = 1 to dim(vv);
v = vv(index);
output;
end;
run;
Now use SQL to sort and to drop the all-missing cases:
proc sql;
create table for_freq as
select * from long
group by group, index
having count(v)>0
order by group, index;
quit;
Now run PROC FREQ:
Proc freq;
Table v/missing;
By group index;
run;
On Wed, 11 May 2005 14:06:17 -0700, Chang, Ei-Wen <Ei-Wen_Chang@CTB.COM>
wrote:
>Hi,
>
>I have a data like this.
>
>Data HaHa;
>Input group v1 v2 v3 v4 v5 ;
>Cards;
>1 2 3 4 5 .
>1 3 4 5 6 .
>2 3 4 . . .
>2 5 6 . . .
>3 2 . . . .
>3 5 . . . .
>4 1 1 1 1 1
>4 4 5 6 7 8
> ;
>
>Proc freq;
>Table v1-v5/missing;
>By group;
>
>====
>
>Numbers of variable for each group are different. If I use Proc freq
>like above, the output of some FD's table will contain only missing
>value. Like this.
>
>
>group=2
> Cumulative Cumulative
>v3 Frequency Percent Frequency Percent
>-------------------------------------------------------
> . 2 100.00 2 100.00
>
>I would like to exclude tables containing missing value only.
>Any good idea??
>
>Thanks in advance.
>
>Ei