Date: Wed, 8 Oct 2003 14:42:22 GMT
Reply-To: julierog@ix.netcom.com
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Roger Lustig <trovato@VERIZON.NET>
Subject: Re: counting with letters / labelling a sequence with letters ???
Content-Type: text/plain; charset=us-ascii; format=flowed
Tomislav:
Have you considered using a format?
proc format;
value alpha
1='A'
2='B'
3='C'
<...>
;
run;
<insert data step here>
proc print;
format chart alpha.;
run;
Now, if the variable itself needs to be alpha, you can use the format in
the data step:
length xchart $1;
xchart = put(chart,alpha.);
Finally, what happens when the number of charts exceeds 26?
Best,
Roger
Tomislav Svoboda wrote:
> Hi everyone,
> is there a way for counting using letters rather than numbers? (e.g.
> counter = 'a';counter +1 = 'b' etc.) I need to label charts for the
> same subject using a sequence of letters rather than a sequence of
> numbers e.g. where the first chart is chart a (rather than chart 1),
> the second chart is chart b (rather than chart 2) etc.
>
> I have the following sample code that I would like to modify for this
> purpose:
>
> data temp;
> input subject @@;
> cards;
> 1 1 1 2 3 3 10 10 10 8 8 8
> ;
> run;
> Proc sort; by subject; run;
> data temp2;
> set temp;
> by subject;
> if first.subject then chart = 1;
> else
> chart + 1;
> run;
> proc print;run;
>
> (If you run this, it labels charts as 1,2,3... I need to label them
> a,b,c ...)
>
> thanks!!
>
> Tomislav
|