Date: Thu, 12 May 2005 20:06:01 +0000
Reply-To: toby dunn <tobydunn@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: toby dunn <tobydunn@HOTMAIL.COM>
Subject: FW: Re: Please help with preloadfmt in Proc Tabulate
Content-Type: text/plain; format=flowed
Diana sent me a email off list stateing that the classdata statement did
infact work (good to know I am puttin my LE of SAS to work, ahemm wink wink
the person who bought it for me should be happy, incedently he is one of the
nicest guys I know) and also wanted to know if she could get the variables
LABEL and Q1 in decending order in proc Tabulates output.
After some tinkering I found that the preloadfmt isn't needed at all and one
can get the desired result with the classdata statement and dscending option
on the class statement.
PROC FORMAT;
VALUE LIKE
9 ='Like Extremely'
8 ='Like very much'
7 ='Like moderately'
6 ='Like slightly'
5 ='Neither like nor dislike'
4 ='Dislike slightly'
3 ='Dislike moderately'
2 ='Dislike very much'
1 ='Dislike extremely';
run ;
data prod;
input id prod q1;
label q1=ranking;
cards;
1 1 8
2 1 2
3 1 7
4 1 6
5 1 7
6 1 5
7 1 8
8 1 6
9 1 8
10 1 6
11 1 7
12 1 3
1 2 9
2 2 4
3 2 8
4 2 5
5 2 7
6 2 7
7 2 2
8 2 6
9 2 .
10 2 7
11 2 7
12 2 8
;
run ;
proc sql noprint ;
select max(q1) ,
max(prod)
into : MaxQ1 ,
: MaxProd
from prod ;
quit ;
data all (drop = i ii);
do i = 1 to &MaxQ1 ;
do ii = 1 to &MaxProd ;
q1 = i ;
label = i ;
prod = ii ;
output ;
end ;
end ;
run ;
Data prod2 ;
set prod ;
score = 1 ;
label = q1 ;
run ;
PROC TABULATE
data = prod2 classdata = all ;
CLASS label q1 / descending;
Class Prod / descending;
VAR score ;
TABLE label*q1, prod*(pctn<label*q1>)*f=4.0/ rts=60 misstext='0' ;
format q1 LIKE. ;
RUN;
HTH
Toby Dunn
From: cannondj@aol.com
To: tobydunn@hotmail.com
Subject: Re: Please help with preloadfmt in Proc Tabulate
Date: Thu, 12 May 2005 15:23:37 -0400
Toby,
That did it. I'm not familar with the classdata data, and will need to read
up on it. Is there a way to list label and q1 in descending order?
Diana
-----Original Message-----
From: toby dunn <tobydunn@hotmail.com>
To: cannondj@AOL.COM; SAS-L@LISTSERV.UGA.EDU
Sent: Thu, 12 May 2005 02:52:30 +0000
Subject: RE: Please help with preloadfmt in Proc Tabulate
Diana,
This should do it:
proc sql noprint ;
select max(q1) ,
max(prod)
into : MaxQ1 ,
: MaxProd
from prod ;
quit ;
data all (drop = i ii);
do i = 1 to &MaxQ1 ;
do ii = 1 to &MaxProd ;
q1 = i ;
label = i ;
prod = ii ;
output ;
end ;
end ;
run ;
Data prod2 ;
set prod ;
score = 1 ;
label = q1 ;
run ;
PROC TABULATE
data = prod2 classdata = all ;
CLASS label prod ;
Class q1 / order = data preloadfmt ;
VAR score ;
TABLE label*q1, prod*(pctn<label*q1>)*f=4.0/ rts=60 misstext='0' ;
format q1 LIKE. ;
RUN;
HTH
Toby Dunn
From: Diana Cannon <cannondj@AOL.COM>
Reply-To: Diana Cannon <cannondj@AOL.COM>
To: SAS-L@LISTSERV.UGA.EDU
Subject: Please help with preloadfmt in Proc Tabulate
Date: Wed, 11 May 2005 19:20:37 -0400
PROC FORMAT;
VALUE LIKE
9 ='Like Extremely'
8 ='Like very much'
7 ='Like moderately'
6 ='Like slightly'
5 ='Neither like nor dislike'
4 ='Dislike slightly'
3 ='Dislike moderately'
2 ='Dislike very much'
1 ='Dislike extremely';
data prod;
input id prod q1;
label q1=ranking;
cards;
1 1 8
2 1 2
3 1 7
4 1 6
5 1 7
6 1 5
7 1 8
8 1 6
9 1 8
10 1 6
11 1 7
12 1 3
1 2 9
2 2 4
3 2 8
4 2 5
5 2 7
6 2 7
7 2 2
8 2 6
9 2 .
10 2 7
11 2 7
12 2 8
;
Data; set prod;
score=1;label=q1;
PROC TABULATE ;
CLASS label prod ;
CLASS q1 /order=data descending preloadfmt ;
VAR score;
TABLE label*q1, prod*(pctn<label*q1>)*f=4.0/ rts=60 misstext='0';
FORMAT q1 like.;
RUN;