Date: Mon, 4 Oct 2004 08:53:16 -0500
Reply-To: "Dunn, Toby" <Toby.Dunn@TEA.STATE.TX.US>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Dunn, Toby" <Toby.Dunn@TEA.STATE.TX.US>
Subject: Re: %SCAN with quotes and blank used as delimiters
Content-Type: text/plain; charset="us-ascii"
Taking Ron's example one further, generally because I often create lists
and process them this way and I could see a person using SQL and
creating a foot note lists from a data set.
As Ron so expertly put it's the quotes being used as the delimiter that
is the problem. Since you are creating this list to be processed simply
change your delimiter to be something other than quotes or a comma.
%let lists = footnote1: aaaaa * footnote2: bbbbb * footnote3: ccccc;
%macro put_fnotes;
%do i = 1 %to 3;
%let foot = %scan(&lists,&i,'*');
%put &foot;
%end;
%mend;
%put_fnotes
Now if you still want those quotes for what ever reason simply do the
following:
%let lists = footnote1: aaaaa * footnote2: bbbbb * footnote3: ccccc;
%macro put_fnotes;
%do i = 1 %to 3;
%let foot = %scan(&lists,&i,'*');
%put "&foot";
%end;
%mend;
%put_fnotes
HTH
Toby Dunn
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Fehd, Ronald J.
Sent: Monday, October 04, 2004 8:29 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: %SCAN with quotes and blank used as delimiters
> From: Dubravko Dolic
> I try to split a list of footnotes into single footnotes using %SCAN.
>
> %let list = "footnote1: content" "Some other footnote" "my
> 3rd footnote";
>
> Now something like
> %SCAN(&list, &counter, %str("));
> or
> %SCAN(&list, &counter, %str(%" ));
>
> should do it to read each single footnote.
>
> Any hints?
actually the delimiter here is the single space in <" ">
of which there are two occurences.
you are stuck here with the ambiguity of
the single space occuring both between tokens
in the quoted material -- the strings --
and between the strings.
using <" "> as the delimiter gets you
unbalanced dQuotes in the first and last items.
why are you (attempting to be) doing this?
consider:
%Let String1 = footnote1: content;
%Let String2 = Some other footnote;
%Let String3 = my 3rd footnote;
either
footnote "&String1 &String2 &String3";
or
footnote "&String1" "&String2" "&String3";
produce your desired result
SQL provides a table with the text of titles and footnotes:
PROC SQL;describe table Dictionary.Titles;quit;
type char(1) label='Title Location',
number num label='Title Number',
text char(256) label='Title Text'
PROC SQL;describe table Dictionary.Titles;quit;
footnote1 'text';
PROC SQL;select distinct *
from Dictionary.Titles
;quit;
Title Title
Location Number Title Text
F 1 text
T 1 The SAS System
Ron Fehd the SQL into:macro maven CDC Atlanta GA USA RJF2 at cdc dot
gov