LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (June 2009, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sat, 6 Jun 2009 12:10:39 -0400
Reply-To:     Jeff <zhujp98@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Jeff <zhujp98@GMAIL.COM>
Subject:      Re: how to pass this string string to macro call
Comments: To: Arthur Tabachneck <art297@netscape.net>
In-Reply-To:  <200906061323.n569qsCI028606@malibu.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1

Thank you for your email. Arthur. %let mlist=(select timeid from cmsdmart.TimeByDay where thedate="&end"d-1); is not what I wanted. here (select timeid from cmsdmart.TimeByDay where thedate="&end"d) will return a single number, for examples 123 which is the time id of then day &end. I want timeid 122 which is from the day before &end. I tried mlist=(select timeid from cmsdmart.TimeByDay where thedate=intnx('day', "&end"d,-1)

I change your code to:

%macro CalculateMetrics012(x,y,themlist,theylist); proc sql; create table test as &themlist. ; quit; %mend; %let end=6jun2009; %let mlist=(select timeid from cmsdmart.TimeByDay where thedate=intnx('day',"&end"d,-1); %let ylist=(select timeid from cmsdmart.TimeByDay where thedate=intnx('day',"&end"d,-1); %CalculateMetrics012(1,2,%str(&mlist), %str(&ylist))

When I run this progam I get log like

1 %macro CalculateMetrics012(x,y,themlist,theylist); 2 proc sql; 3 create table test as &themlist. 4 ; 5 quit; 6 %mend; 7 %let end=6jun2009; 8 %let mlist=(select timeid from cmsdmart.TimeByDay where 8 ! thedate=intnx('day',"&end"d,-1); 9 %let ylist=(select timeid from cmsdmart.TimeByDay where 9 ! thedate=intnx('day',"&end"d,-1); 10 %CalculateMetrics012(1,2,%str(&mlist), %str(&ylist))

any the progam stalled here. why the program stalled in this way? and Is there a solution to this problem?

Thanks. Jeff

On Sat, Jun 6, 2009 at 10:23 AM, Arthur Tabachneck <art297@netscape.net>wrote:

> Jeff, > > Is there a chance that it is your ending paraenthesis rather than the minus > sign that is causing the error? > > I don't know if the following approximates what you are trying to do, but > it > works: > > %macro CalculateMetrics012(x,y,themlist,theylist); > proc sql; > create table test as &themlist. > ; > quit; > %mend; > %let end=6jun2009; > %let mlist=(select timeid from cmsdmart.TimeByDay where thedate="&end"d-1); > %let ylist=(select timeid from cmsdmart.TimeByDay where thedate="&end"d-1); > %CalculateMetrics012(1,2,%str(&mlist), %str(&ylist)) > > Art > ---------- > On Fri, 5 Jun 2009 23:47:19 -0400, Jeff <zhujp98@GMAIL.COM> wrote: > > >I want to pass mlist which contain "-" as entire string to macro call. How > >can I do that? > >THX > >Jeff > > > > > >552 > >553 > >554 %let mlist=(select timeid from cmsdmart.TimeByDay where > >thedate="&end"d)-1; > >555 %let ylist=(select timeid from cmsdmart.TimeByDay where > >thedate="&end"d)-1; > >556 %CalculateMetrics012(1,2,%str(&mlist), %str(&ylist)); > >NOTE: Line generated by the macro variable "MTLIST". > >1 (select timeid from cmsdmart.TimeByDay where thedate="30apr2009"d)-1 > > - > > 22 > > - > > > 76 > >ERROR 22-322: Syntax error, expecting one of the following: !, &, AND, > >GROUP, HAVING, OR, ORDER, > > |. > > > >ERROR 76-322: Syntax error, statement will be ignored. > > > >NOTE: The SAS System stopped processing this step because of errors. > >NOTE: PROCEDURE SQL used (Total process time): > > real time 0.00 seconds > > cpu time 0.00 seconds > > > > > > > >NOTE: Line generated by the macro variable "YRLIST". > >1 (select timeid from cmsdmart.TimeByDay where thedate="30apr2009"d)-1 > > - > > 22 > > - > > > 76 > >ERROR 22-322: Syntax error, expecting one of the following: !, &, AND, > >GROUP, HAVING, OR, ORDER, > > |. > > > >ERROR 76-322: Syntax error, statement will be ignored. >


Back to: Top of message | Previous page | Main SAS-L page