From: Yu Zhang on
proc format ;
value catfmt 0-1='Category 1'
2-5='Category 2'
6-10='Category 3';
run;

proc tabulate data=have;
class date var ID;

table date*var='',ID*(N*f=8. pctn<var>='%'*f=8.)/misstext='0';
format var catfmt.;
run;

HTH

Yu

On Mon, Dec 14, 2009 at 6:16 AM, Randy <randistan69(a)hotmail.com> wrote:

> Dear All:
> My portion of my data set is as follows:
>
> Date ID Var
> Mar1 A 1
> Mar1 A 3
> Mar1 A 10
> Mar1 A 4
> Mar1 A 5
> Mar1 B 4
> Mar1 B 5
> Mar1 B 7
> Mar2 A 2
> Mar2 A 0
> Mar2 A 3
> Mar2 A 4
> Mar2 A 1
> Mar2 A 1
> Mar2 B 9
> Mar2 B 7
> Mar2 B 6
> Mar2 B 8
>
> I want three categories
> 0-1 Category 1
> 2-5 Category 2
> 6-10 Category 3
>
> My Table should look like
>
> A PercentA B PercentB
> Mar1
> 0-1 1 20% 0 0%
> 2-5 3 60% 2 67%
> 6-10 1 20% 1 33%
> Mar2
> 0-1 3 60% 0 0%
> 2-5 2 40% 4 100%
> 6-10 0 0% 0 0%
>
> Please help
>
From: Randy on
If there is no observation in a particular category how do get SAS to say 0
observations and 0%?
Randy

On Mon, 14 Dec 2009 07:16:12 -0500, Randy <randistan69(a)HOTMAIL.COM> wrote:

>Dear All:
>My portion of my data set is as follows:
>
>Date ID Var
>Mar1 A 1
>Mar1 A 3
>Mar1 A 10
>Mar1 A 4
>Mar1 A 5
>Mar1 B 4
>Mar1 B 5
>Mar1 B 7
>Mar2 A 2
>Mar2 A 0
>Mar2 A 3
>Mar2 A 4
>Mar2 A 1
>Mar2 A 1
>Mar2 B 9
>Mar2 B 7
>Mar2 B 6
>Mar2 B 8
>
>I want three categories
>0-1 Category 1
>2-5 Category 2
>6-10 Category 3
>
>My Table should look like
>
> A PercentA B PercentB
>Mar1
>0-1 1 20% 0 0%
>2-5 3 60% 2 67%
>6-10 1 20% 1 33%
>Mar2
>0-1 3 60% 0 0%
>2-5 2 40% 4 100%
>6-10 0 0% 0 0%
>
>Please help
From: Sid N on
You can add the "printmiss" option:

proc tabulate data=have;
class date var ID;

table date*var='',ID*(N*f=8. pctn<var>='%'*f=8.)/misstext='0' *printmiss*;
format var catfmt.;
run;

Hope this helps.

Sid

On Mon, Dec 14, 2009 at 5:57 PM, Randy <randistan69(a)hotmail.com> wrote:

> If there is no observation in a particular category how do get SAS to say 0
> observations and 0%?
> Randy
>
> On Mon, 14 Dec 2009 07:16:12 -0500, Randy <randistan69(a)HOTMAIL.COM> wrote:
>
> >Dear All:
> >My portion of my data set is as follows:
> >
> >Date ID Var
> >Mar1 A 1
> >Mar1 A 3
> >Mar1 A 10
> >Mar1 A 4
> >Mar1 A 5
> >Mar1 B 4
> >Mar1 B 5
> >Mar1 B 7
> >Mar2 A 2
> >Mar2 A 0
> >Mar2 A 3
> >Mar2 A 4
> >Mar2 A 1
> >Mar2 A 1
> >Mar2 B 9
> >Mar2 B 7
> >Mar2 B 6
> >Mar2 B 8
> >
> >I want three categories
> >0-1 Category 1
> >2-5 Category 2
> >6-10 Category 3
> >
> >My Table should look like
> >
> > A PercentA B PercentB
> >Mar1
> >0-1 1 20% 0 0%
> >2-5 3 60% 2 67%
> >6-10 1 20% 1 33%
> >Mar2
> >0-1 3 60% 0 0%
> >2-5 2 40% 4 100%
> >6-10 0 0% 0 0%
> >
> >Please help
>
From: Arthur Tabachneck on
Randy,

Remove the misplaced semicolons. I.e.,

proc format ;
value catfmt 0-1='Category 1'
2-10 ='Category 2'
11-20 ='Category 3'
21-30 ='Category 4'
31-40 ='Category 5'
41-50 ='Category 6'
51-60 ='Category 7'
61-70 ='Category 8'
71-80 ='Category 9'
81-90 ='Category 10'
91-100 ='Category 11';
run;

HTH,
Art
--------
On Mon, 14 Dec 2009 21:07:46 -0500, Randy <randistan69(a)HOTMAIL.COM> wrote:

>I am making a mistake somewhere
>
>
>proc format ;
>value catfmt 0-1='Category 1' ;
>2-10 ='Category 2' ;
>11-20 ='Category 3';
>21-30 ='Category 4';
>31-40 ='Category 5'
>41-50 ='Category 6';
>51-60 ='Category 7';
>61-70 ='Category 8';
>71-80 ='Category 9' ;
>81-90 ='Category 10';
>91-100 ='Category 11';
>run;
>
>proc tabulate data = Have;
>class date var ID;
>table date*var='',ID*(N*f=8. pctn<var>='%'*f=8.)
>/misstext='0' printmiss ;
>format var catfmt.;
>run;
>
>
>When i run the code I am getting categories 12 13 14 etc....
>What is my mistake?
>
>On Mon, 14 Dec 2009 18:23:39 -0600, Sid N <nsid31(a)GMAIL.COM> wrote:
>
>>You can add the "printmiss" option:
>>
>>proc tabulate data=have;
>>class date var ID;
>>
>>table date*var='',ID*(N*f=8. pctn<var>='%'*f=8.)/misstext='0' *printmiss*;
>>format var catfmt.;
>>run;
>>
>>Hope this helps.
>>
>>Sid
>>
>>On Mon, Dec 14, 2009 at 5:57 PM, Randy <randistan69(a)hotmail.com> wrote:
>>
>>> If there is no observation in a particular category how do get SAS to
say 0
>>> observations and 0%?
>>> Randy
>>>
>>> On Mon, 14 Dec 2009 07:16:12 -0500, Randy <randistan69(a)HOTMAIL.COM>
wrote:
>>>
>>> >Dear All:
>>> >My portion of my data set is as follows:
>>> >
>>> >Date ID Var
>>> >Mar1 A 1
>>> >Mar1 A 3
>>> >Mar1 A 10
>>> >Mar1 A 4
>>> >Mar1 A 5
>>> >Mar1 B 4
>>> >Mar1 B 5
>>> >Mar1 B 7
>>> >Mar2 A 2
>>> >Mar2 A 0
>>> >Mar2 A 3
>>> >Mar2 A 4
>>> >Mar2 A 1
>>> >Mar2 A 1
>>> >Mar2 B 9
>>> >Mar2 B 7
>>> >Mar2 B 6
>>> >Mar2 B 8
>>> >
>>> >I want three categories
>>> >0-1 Category 1
>>> >2-5 Category 2
>>> >6-10 Category 3
>>> >
>>> >My Table should look like
>>> >
>>> > A PercentA B PercentB
>>> >Mar1
>>> >0-1 1 20% 0 0%
>>> >2-5 3 60% 2 67%
>>> >6-10 1 20% 1 33%
>>> >Mar2
>>> >0-1 3 60% 0 0%
>>> >2-5 2 40% 4 100%
>>> >6-10 0 0% 0 0%
>>> >
>>> >Please help
>>>
From: Randy on
I am making a mistake somewhere


proc format ;
value catfmt 0-1='Category 1' ;
2-10 ='Category 2' ;
11-20 ='Category 3';
21-30 ='Category 4';
31-40 ='Category 5'
41-50 ='Category 6';
51-60 ='Category 7';
61-70 ='Category 8';
71-80 ='Category 9' ;
81-90 ='Category 10';
91-100 ='Category 11';
run;

proc tabulate data = Have;
class date var ID;
table date*var='',ID*(N*f=8. pctn<var>='%'*f=8.)
/misstext='0' printmiss ;
format var catfmt.;
run;


When i run the code I am getting categories 12 13 14 etc....
What is my mistake?

On Mon, 14 Dec 2009 18:23:39 -0600, Sid N <nsid31(a)GMAIL.COM> wrote:

>You can add the "printmiss" option:
>
>proc tabulate data=have;
>class date var ID;
>
>table date*var='',ID*(N*f=8. pctn<var>='%'*f=8.)/misstext='0' *printmiss*;
>format var catfmt.;
>run;
>
>Hope this helps.
>
>Sid
>
>On Mon, Dec 14, 2009 at 5:57 PM, Randy <randistan69(a)hotmail.com> wrote:
>
>> If there is no observation in a particular category how do get SAS to say 0
>> observations and 0%?
>> Randy
>>
>> On Mon, 14 Dec 2009 07:16:12 -0500, Randy <randistan69(a)HOTMAIL.COM> wrote:
>>
>> >Dear All:
>> >My portion of my data set is as follows:
>> >
>> >Date ID Var
>> >Mar1 A 1
>> >Mar1 A 3
>> >Mar1 A 10
>> >Mar1 A 4
>> >Mar1 A 5
>> >Mar1 B 4
>> >Mar1 B 5
>> >Mar1 B 7
>> >Mar2 A 2
>> >Mar2 A 0
>> >Mar2 A 3
>> >Mar2 A 4
>> >Mar2 A 1
>> >Mar2 A 1
>> >Mar2 B 9
>> >Mar2 B 7
>> >Mar2 B 6
>> >Mar2 B 8
>> >
>> >I want three categories
>> >0-1 Category 1
>> >2-5 Category 2
>> >6-10 Category 3
>> >
>> >My Table should look like
>> >
>> > A PercentA B PercentB
>> >Mar1
>> >0-1 1 20% 0 0%
>> >2-5 3 60% 2 67%
>> >6-10 1 20% 1 33%
>> >Mar2
>> >0-1 3 60% 0 0%
>> >2-5 2 40% 4 100%
>> >6-10 0 0% 0 0%
>> >
>> >Please help
>>
 |  Next  |  Last
Pages: 1 2
Prev: SAS dynamic arrays
Next: Prevalence and Bias Index