Date: Thu, 12 Mar 2009 05:13:19 -0400
Reply-To: Jim Groeneveld <jim.1stat@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jim Groeneveld <jim.1stat@YAHOO.COM>
Subject: Re: Hi ver urget
Hi Kumar,
Download my (SPSS sytax-like) SAS macro _Count_ from
http://home.hccnet.nl/jim.groeneveld/count
Put the macro in your AUTOCALL macro directory
(or just %INClude the macro file)
and run the following program:
FILENAME AutoCall '<<your AutoCall directory path here>>';
OPTIONS LS=80 PS=63 MAUTOSOURCE SASAUTOS = (AutoCall);
data a;
input ID jan $ feb$ mar $ aug $;
cards;
1 b p c b
2 p b c p
3 c b b b
4 b p c b
5 p b c p
6 c b p c
;
run;
DATA A;
SET A;
%_Count_ (( /* SPSS-like syntax and functionality */
B_count = Jan Feb Mar Aug ('b') /
P_count = Jan Feb Mar Aug ('p') /
C_count = Jan Feb Mar Aug ('c')
)); /* note the double parentheses around the SPSS-like code */
RUN;
proc print data=a; run;
Regards - Jim.
--
Jim Groeneveld, Netherlands
Statistician, SAS consultant
home.hccnet.nl/jim.groeneveld
My computer, my wife and I will attend SGF 2009 near Washington.
On Thu, 12 Mar 2009 00:11:46 -0700, kumar <urs.kumar22@GMAIL.COM> wrote:
>Hi
>i have a dataset like these
>
>data a;
>input ID jan $ feb$ mar $ aug $;
>cards;
>1 b p c b
>2 p b c p
>3 c b b b
>4 b p c b
>5 p b c p
>6 c b p c
>;
>run;
>
>In these data set i have output
>the count of b's ,p's and c's by id
>
>ID Count of b's Count of p's Count of C's
>1 2 1 2
>2 1 2 1
>3 3 0 1
>4 2 1 2
>5 1 2 1
>6 1 1 2
>
>Thanks & regards,
>Kumar.