|
One of the words includes quotes but you did not preserve them.
What is a word?
On 5/4/12, toby dunn <tobydunn@hotmail.com> wrote:
> You lost me soem where.... a well formed list is just a list of words
> seperated by a space....
>
> Toby Dunn
>
>
> If you get thrown from a horse, you have to get up and get back on, unless
> you landed on a cactus; then you have to roll around and scream in pain.
>
> “Any idiot can face a crisis—it’s day to day living that wears you out”
> ~ Anton Chekhov
>
>
>
>> Date: Fri, 4 May 2012 09:39:06 -0500
>> Subject: Re: My new favorite macro method to convert a space-delimited
>> list to quoted csv
>> From: iebupdte@gmail.com
>> To: tobydunn@hotmail.com
>> CC: SAS-L@listserv.uga.edu
>>
>> Based on your notion of a well formed list of words shouldn’t you
>> preserve the existing quotes. Where you end up with a word that looks
>> like that returned by QUOTE function.
>>
>> 1 %put NOTE: %sysfunc(quote("Toby"));
>> NOTE: """Toby"""
>>
>>
>> On 5/4/12, toby dunn <tobydunn@hotmail.com> wrote:
>> > 8 %Let VarList = One "Two" Three;
>> > 39 %Let VarList = %SysFunc( PrxChange(
>> > s/(?:\s+|\A)([a-z0-9]+)(?:\s+|\Z)/
>> > "$1" /i , -1 , &VarList
>> > 39 ! ) ) ;
>> > 40 %Let VaRList = %Sysfunc( PrxChange( s/\s+/%str(,)/ , -1 , &VarList )
>> > )
>> > ;
>> > 41 %Put VarList = &VarList ;
>> > VarList = "One","Two","Three"
>> >
>> > I used two calls mainly because I think its easier for me to read and
>> > understand....more of a divide and conquer the problem.
>> >
>> > OR
>> >
>> >
>> > 2 %Let VarList = "One Two Three" ;
>> > 43 %Let VaRList = %Sysfunc( PrxChange( s/\s+/"%str(,)"/ , -1 , &VarList
>> > )
>> > ) ;
>> > 44 %Put VarList = &VarList ;
>> > VarList = "One","Two","Three"
>> >
>> >
>> >
>> > Toby Dunn
>> >
>> >
>> > If you get thrown from a horse, you have to get up and get back on,
>> > unless
>> > you landed on a cactus; then you have to roll around and scream in
>> > pain.
>> >
>> > “Any idiot can face a crisis—it’s day to day living that wears you out”
>> > ~ Anton Chekhov
>> >
>> >
>> >
>> >> Date: Fri, 4 May 2012 07:32:12 -0500
>> >> From: iebupdte@GMAIL.COM
>> >> Subject: Re: My new favorite macro method to convert a space-delimited
>> >> list to quoted csv
>> >> To: SAS-L@LISTSERV.UGA.EDU
>> >>
>> >> I was going to ask what happens when KEYS_QC= contains a "SAS Variable
>> >> List"?
>> >>
>> >> On 5/4/12, Tom Abernathy <tom.abernathy@gmail.com> wrote:
>> >> > I still find using the individually named functions makes the code
>> >> > much
>> >> > easier
>> >> > to understand then PRX.
>> >> >
>> >> > %let keys_qc = "%sysfunc(tranwrd(&keys,%str( ),%str(",")))";
>> >> > %let keys_qc = "%sysfunc(prxchange(s/\s+/%str(",")/,-1,&keys))";
>> >> >
>> >> > On Thu, 3 May 2012 16:41:40 -0700, Sterling Paramore
>> >> > <gnilrets@GMAIL.COM>
>> >> > wrote:
>> >> >
>> >> >>15 %let keys = one two three;
>> >> >>16 %let keys_qc =
>> >> >>%unquote(%str(%")%sysfunc(prxchange(s/\s+/","/,-1,&keys))%str(%"));
>> >> >>17 %put keys_qc = &keys_qc;
>> >> >>keys_qc = "one","two","three"
>> >> >>
>> >> >>
>> >> >>I avoided regular expressions for years. Now I love them!
>> >> >
>> >
>
|