Date: Tue, 22 Dec 2009 08:45:00 -0800
Reply-To: "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Subject: Re: bquote and unquote
In-Reply-To: <5ade6849-c1ec-406f-a2f5-89802584c948@f6g2000vbp.googlegroups.com>
Content-Type: text/plain; charset=windows-1252
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> Minion
> Sent: Tuesday, December 22, 2009 7:48 AM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Re: bquote and unquote
>
> On Dec 22, 8:45 am, "data _null_;" <datan...@gmail.com> wrote:
> > On Dec 22, 7:06 am, Minion <acfar...@gmail.com> wrote:
> >
> > > After 60 mins of reviewing the archives and trying various
> > > combinations, I have to admit defeat. My only consolation is that
> > > other experienced folks have got stuck on this as well. I need to
> > > write a string ('col1,col2') with embedded commas e.g.
> >
> > > %let cols = %bquote(col1,col2) ;
> > > data _null_ ;
> > > put %unquote(&cols) ;
> > > run ;
> >
> > > This is for V8.2 on OS/390
> >
> > 261 %let cols = %bquote(col1,col2) ;
> > 262 data _null_;
> > 263 put "('&cols')";
> > 264 run;
> >
> > ('col1,col2')
> >
> > Do I understand the question?
>
> Oh dear. I should have been more specific. I need the output to be:
>
> col1,col2
>
> This suggestion may be a good compromise but I feel there is something
> more elegant out there.
>
> sum=sum(%sysfunc(dequote(&cols))) ;
I guess I don't understand the problem either. It looks to me like all this quoting and unquoting is not necessary. This following will work if you want to sum up columns. What are you not telling us about what you really want to do?
%let col = col1,col2 ;
Data something;
Set something_else;
Sum = sum(&col);
Run;
Dan
Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204
|