Macro error

  • Follow


All:

i am using the simple code here . and i getiing an errror in the log .
i was expecting outvar to be resolved to agemax.. it does .. but NOT
in the datastep test1..

Any suggestions ...

options mlogic symbolgen;
%macro calc(invar = , outvar= );
proc sql;
  create table test as
  select name,sex,max(&invar) as &outvar
  from sashelp.class
  order by sex;
quit;
ods trace on ;
Ods output summary=means1 ;

proc means data = test median mean stderr clm ;
  by sex;
  var &outvar;
run;
ods listing close;
 data test1;
    set means1;
   LL = &outvar_mean - 1.96*  &outvar_STDERR;
   UL = &outvar_mean + 1.96*  &outvar_STDERR;
run;
%mend;

%calc(invar = age , outvar = agemax);



22: LINE and COLUMN cannot be determined.
NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL may allow
recovery of the LINE and COLUMN
              where the error has occurred.
ERROR 22-322: Syntax error, expecting one of the following: a name, a
quoted string,
              a numeric constant, a datetime constant, a missing
value, INPUT, PUT.
WARNING: Apparent symbolic reference OUTVAR_MEAN not resolved.
22: LINE and COLUMN cannot be determined.
NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL may allow
recovery of the LINE and COLUMN
              where the error has occurred.
ERROR 22-322: Syntax error, expecting one of the following: a name, a
quoted string,
              a numeric constant, a datetime constant, a missing
value, INPUT, PUT.
WARNING: Apparent symbolic reference OUTVAR_STDERR not resolved.
22: LINE and COLUMN cannot be determined.
NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL may allow
recovery of the LINE and COLUMN
              where the error has occurred.
ERROR 22-322: Syntax error, expecting one of the following: a name, a
quoted string,
              a numeric constant, a datetime constant, a missing
value, INPUT, PUT.
WARNING: Apparent symbolic reference OUTVAR_MEAN not resolved.
22: LINE and COLUMN cannot be determined.
NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL may allow
recovery of the LINE and COLUMN
              where the error has occurred.
ERROR 22-322: Syntax error, expecting one of the following: a name, a
quoted string,
              a numeric constant, a datetime constant, a missing
value, INPUT, PUT.
WARNING: Apparent symbolic reference OUTVAR_STDERR not resolved.

0
Reply Al 3/23/2011 9:26:50 PM

On Mar 23, 2:26=A0pm, Al <ali6...@gmail.com> wrote:
> All:
>
> i am using the simple code here . and i getiing an errror in the log .
> i was expecting outvar to be resolved to agemax.. it does .. but NOT
> in the datastep test1..
>
> Any suggestions ...
>
> options mlogic symbolgen;
> %macro calc(invar =3D , outvar=3D );
> proc sql;
> =A0 create table test as
> =A0 select name,sex,max(&invar) as &outvar
> =A0 from sashelp.class
> =A0 order by sex;
> quit;
> ods trace on ;
> Ods output summary=3Dmeans1 ;
>
> proc means data =3D test median mean stderr clm ;
> =A0 by sex;
> =A0 var &outvar;
> run;
> ods listing close;
> =A0data test1;
> =A0 =A0 set means1;
> =A0 =A0LL =3D &outvar_mean - 1.96* =A0&outvar_STDERR;
> =A0 =A0UL =3D &outvar_mean + 1.96* =A0&outvar_STDERR;
> run;
> %mend;
>
> %calc(invar =3D age , outvar =3D agemax);
>
> 22: LINE and COLUMN cannot be determined.
> NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL may allow
> recovery of the LINE and COLUMN
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 where the error has occurred.
> ERROR 22-322: Syntax error, expecting one of the following: a name, a
> quoted string,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 a numeric constant, a datetime constant, a mi=
ssing
> value, INPUT, PUT.
> WARNING: Apparent symbolic reference OUTVAR_MEAN not resolved.
> 22: LINE and COLUMN cannot be determined.
> NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL may allow
> recovery of the LINE and COLUMN
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 where the error has occurred.
> ERROR 22-322: Syntax error, expecting one of the following: a name, a
> quoted string,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 a numeric constant, a datetime constant, a mi=
ssing
> value, INPUT, PUT.
> WARNING: Apparent symbolic reference OUTVAR_STDERR not resolved.
> 22: LINE and COLUMN cannot be determined.
> NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL may allow
> recovery of the LINE and COLUMN
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 where the error has occurred.
> ERROR 22-322: Syntax error, expecting one of the following: a name, a
> quoted string,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 a numeric constant, a datetime constant, a mi=
ssing
> value, INPUT, PUT.
> WARNING: Apparent symbolic reference OUTVAR_MEAN not resolved.
> 22: LINE and COLUMN cannot be determined.
> NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL may allow
> recovery of the LINE and COLUMN
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 where the error has occurred.
> ERROR 22-322: Syntax error, expecting one of the following: a name, a
> quoted string,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 a numeric constant, a datetime constant, a mi=
ssing
> value, INPUT, PUT.
> WARNING: Apparent symbolic reference OUTVAR_STDERR not resolved.

Remove the ods listing close and the trace lines you probably don't
need those in macro code and I think that's causing some of the
errors.

&outvar_mean and &outvar_max are not macro variables which is how
you're referring to them.

You can tell sas to resolve the &outvar macro variable with a period
after it

ie &outvar._mean

HTH,
Reeza

0
Reply Reeza 3/23/2011 10:34:47 PM


On Mar 23, 5:34=A0pm, Reeza <fkhurs...@hotmail.com> wrote:
> On Mar 23, 2:26=A0pm, Al <ali6...@gmail.com> wrote:
>
>
>
>
>
> > All:
>
> > i am using the simple code here . and i getiing an errror in the log .
> > i was expecting outvar to be resolved to agemax.. it does .. but NOT
> > in the datastep test1..
>
> > Any suggestions ...
>
> > options mlogic symbolgen;
> > %macro calc(invar =3D , outvar=3D );
> > proc sql;
> > =A0 create table test as
> > =A0 select name,sex,max(&invar) as &outvar
> > =A0 from sashelp.class
> > =A0 order by sex;
> > quit;
> > ods trace on ;
> > Ods output summary=3Dmeans1 ;
>
> > proc means data =3D test median mean stderr clm ;
> > =A0 by sex;
> > =A0 var &outvar;
> > run;
> > ods listing close;
> > =A0data test1;
> > =A0 =A0 set means1;
> > =A0 =A0LL =3D &outvar_mean - 1.96* =A0&outvar_STDERR;
> > =A0 =A0UL =3D &outvar_mean + 1.96* =A0&outvar_STDERR;
> > run;
> > %mend;
>
> > %calc(invar =3D age , outvar =3D agemax);
>
> > 22: LINE and COLUMN cannot be determined.
> > NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL may allow
> > recovery of the LINE and COLUMN
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 where the error has occurred.
> > ERROR 22-322: Syntax error, expecting one of the following: a name, a
> > quoted string,
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 a numeric constant, a datetime constant, a =
missing
> > value, INPUT, PUT.
> > WARNING: Apparent symbolic reference OUTVAR_MEAN not resolved.
> > 22: LINE and COLUMN cannot be determined.
> > NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL may allow
> > recovery of the LINE and COLUMN
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 where the error has occurred.
> > ERROR 22-322: Syntax error, expecting one of the following: a name, a
> > quoted string,
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 a numeric constant, a datetime constant, a =
missing
> > value, INPUT, PUT.
> > WARNING: Apparent symbolic reference OUTVAR_STDERR not resolved.
> > 22: LINE and COLUMN cannot be determined.
> > NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL may allow
> > recovery of the LINE and COLUMN
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 where the error has occurred.
> > ERROR 22-322: Syntax error, expecting one of the following: a name, a
> > quoted string,
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 a numeric constant, a datetime constant, a =
missing
> > value, INPUT, PUT.
> > WARNING: Apparent symbolic reference OUTVAR_MEAN not resolved.
> > 22: LINE and COLUMN cannot be determined.
> > NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL may allow
> > recovery of the LINE and COLUMN
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 where the error has occurred.
> > ERROR 22-322: Syntax error, expecting one of the following: a name, a
> > quoted string,
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 a numeric constant, a datetime constant, a =
missing
> > value, INPUT, PUT.
> > WARNING: Apparent symbolic reference OUTVAR_STDERR not resolved.
>
> Remove the ods listing close and the trace lines you probably don't
> need those in macro code and I think that's causing some of the
> errors.
>
> &outvar_mean and &outvar_max are not macro variables which is how
> you're referring to them.
>
> You can tell sas to resolve the &outvar macro variable with a period
> after it
>
> ie &outvar._mean
>
> HTH,
> Reeza- Hide quoted text -
>
> - Show quoted text -

&outvar._mean  resolved the issue...

Thanks for your help
0
Reply Al 3/23/2011 10:58:11 PM

On Mar 23, 5:58=A0pm, Al <ali6...@gmail.com> wrote:
> On Mar 23, 5:34=A0pm, Reeza <fkhurs...@hotmail.com> wrote:
>
>
>
>
>
> > On Mar 23, 2:26=A0pm, Al <ali6...@gmail.com> wrote:
>
> > > All:
>
> > > i am using the simple code here . and i getiing an errror in the log =
..
> > > i was expecting outvar to be resolved to agemax.. it does .. but NOT
> > > in the datastep test1..
>
> > > Any suggestions ...
>
> > > options mlogic symbolgen;
> > > %macro calc(invar =3D , outvar=3D );
> > > proc sql;
> > > =A0 create table test as
> > > =A0 select name,sex,max(&invar) as &outvar
> > > =A0 from sashelp.class
> > > =A0 order by sex;
> > > quit;
> > > ods trace on ;
> > > Ods output summary=3Dmeans1 ;
>
> > > proc means data =3D test median mean stderr clm ;
> > > =A0 by sex;
> > > =A0 var &outvar;
> > > run;
> > > ods listing close;
> > > =A0data test1;
> > > =A0 =A0 set means1;
> > > =A0 =A0LL =3D &outvar_mean - 1.96* =A0&outvar_STDERR;
> > > =A0 =A0UL =3D &outvar_mean + 1.96* =A0&outvar_STDERR;
> > > run;
> > > %mend;
>
> > > %calc(invar =3D age , outvar =3D agemax);
>
> > > 22: LINE and COLUMN cannot be determined.
> > > NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL may allow
> > > recovery of the LINE and COLUMN
> > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 where the error has occurred.
> > > ERROR 22-322: Syntax error, expecting one of the following: a name, a
> > > quoted string,
> > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 a numeric constant, a datetime constant, =
a missing
> > > value, INPUT, PUT.
> > > WARNING: Apparent symbolic reference OUTVAR_MEAN not resolved.
> > > 22: LINE and COLUMN cannot be determined.
> > > NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL may allow
> > > recovery of the LINE and COLUMN
> > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 where the error has occurred.
> > > ERROR 22-322: Syntax error, expecting one of the following: a name, a
> > > quoted string,
> > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 a numeric constant, a datetime constant, =
a missing
> > > value, INPUT, PUT.
> > > WARNING: Apparent symbolic reference OUTVAR_STDERR not resolved.
> > > 22: LINE and COLUMN cannot be determined.
> > > NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL may allow
> > > recovery of the LINE and COLUMN
> > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 where the error has occurred.
> > > ERROR 22-322: Syntax error, expecting one of the following: a name, a
> > > quoted string,
> > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 a numeric constant, a datetime constant, =
a missing
> > > value, INPUT, PUT.
> > > WARNING: Apparent symbolic reference OUTVAR_MEAN not resolved.
> > > 22: LINE and COLUMN cannot be determined.
> > > NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL may allow
> > > recovery of the LINE and COLUMN
> > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 where the error has occurred.
> > > ERROR 22-322: Syntax error, expecting one of the following: a name, a
> > > quoted string,
> > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 a numeric constant, a datetime constant, =
a missing
> > > value, INPUT, PUT.
> > > WARNING: Apparent symbolic reference OUTVAR_STDERR not resolved.
>
> > Remove the ods listing close and the trace lines you probably don't
> > need those in macro code and I think that's causing some of the
> > errors.
>
> > &outvar_mean and &outvar_max are not macro variables which is how
> > you're referring to them.
>
> > You can tell sas to resolve the &outvar macro variable with a period
> > after it
>
> > ie &outvar._mean
>
> > HTH,
> > Reeza- Hide quoted text -
>
> > - Show quoted text -
>
> &outvar._mean =A0resolved the issue...
>
> Thanks for your help- Hide quoted text -
>
> - Show quoted text -

i am trying to this macro variable in proc gplot  and the proc does
NOT recognize it .. any suggestions ???

proc gplot data =3D inputdata
    plot &outvar._mean*sex =3D weight ;
run;
0
Reply Al 3/23/2011 11:49:25 PM

On Mar 23, 4:49=A0pm, Al <ali6...@gmail.com> wrote:
> On Mar 23, 5:58=A0pm, Al <ali6...@gmail.com> wrote:
>
>
>
>
>
> > On Mar 23, 5:34=A0pm, Reeza <fkhurs...@hotmail.com> wrote:
>
> > > On Mar 23, 2:26=A0pm, Al <ali6...@gmail.com> wrote:
>
> > > > All:
>
> > > > i am using the simple code here . and i getiing an errror in the lo=
g .
> > > > i was expecting outvar to be resolved to agemax.. it does .. but NO=
T
> > > > in the datastep test1..
>
> > > > Any suggestions ...
>
> > > > options mlogic symbolgen;
> > > > %macro calc(invar =3D , outvar=3D );
> > > > proc sql;
> > > > =A0 create table test as
> > > > =A0 select name,sex,max(&invar) as &outvar
> > > > =A0 from sashelp.class
> > > > =A0 order by sex;
> > > > quit;
> > > > ods trace on ;
> > > > Ods output summary=3Dmeans1 ;
>
> > > > proc means data =3D test median mean stderr clm ;
> > > > =A0 by sex;
> > > > =A0 var &outvar;
> > > > run;
> > > > ods listing close;
> > > > =A0data test1;
> > > > =A0 =A0 set means1;
> > > > =A0 =A0LL =3D &outvar_mean - 1.96* =A0&outvar_STDERR;
> > > > =A0 =A0UL =3D &outvar_mean + 1.96* =A0&outvar_STDERR;
> > > > run;
> > > > %mend;
>
> > > > %calc(invar =3D age , outvar =3D agemax);
>
> > > > 22: LINE and COLUMN cannot be determined.
> > > > NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL may allow
> > > > recovery of the LINE and COLUMN
> > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 where the error has occurred.
> > > > ERROR 22-322: Syntax error, expecting one of the following: a name,=
 a
> > > > quoted string,
> > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 a numeric constant, a datetime constant=
, a missing
> > > > value, INPUT, PUT.
> > > > WARNING: Apparent symbolic reference OUTVAR_MEAN not resolved.
> > > > 22: LINE and COLUMN cannot be determined.
> > > > NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL may allow
> > > > recovery of the LINE and COLUMN
> > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 where the error has occurred.
> > > > ERROR 22-322: Syntax error, expecting one of the following: a name,=
 a
> > > > quoted string,
> > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 a numeric constant, a datetime constant=
, a missing
> > > > value, INPUT, PUT.
> > > > WARNING: Apparent symbolic reference OUTVAR_STDERR not resolved.
> > > > 22: LINE and COLUMN cannot be determined.
> > > > NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL may allow
> > > > recovery of the LINE and COLUMN
> > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 where the error has occurred.
> > > > ERROR 22-322: Syntax error, expecting one of the following: a name,=
 a
> > > > quoted string,
> > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 a numeric constant, a datetime constant=
, a missing
> > > > value, INPUT, PUT.
> > > > WARNING: Apparent symbolic reference OUTVAR_MEAN not resolved.
> > > > 22: LINE and COLUMN cannot be determined.
> > > > NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL may allow
> > > > recovery of the LINE and COLUMN
> > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 where the error has occurred.
> > > > ERROR 22-322: Syntax error, expecting one of the following: a name,=
 a
> > > > quoted string,
> > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 a numeric constant, a datetime constant=
, a missing
> > > > value, INPUT, PUT.
> > > > WARNING: Apparent symbolic reference OUTVAR_STDERR not resolved.
>
> > > Remove the ods listing close and the trace lines you probably don't
> > > need those in macro code and I think that's causing some of the
> > > errors.
>
> > > &outvar_mean and &outvar_max are not macro variables which is how
> > > you're referring to them.
>
> > > You can tell sas to resolve the &outvar macro variable with a period
> > > after it
>
> > > ie &outvar._mean
>
> > > HTH,
> > > Reeza- Hide quoted text -
>
> > > - Show quoted text -
>
> > &outvar._mean =A0resolved the issue...
>
> > Thanks for your help- Hide quoted text -
>
> > - Show quoted text -
>
> i am trying to this macro variable in proc gplot =A0and the proc does
> NOT recognize it .. any suggestions ???
>
> proc gplot data =3D inputdata
> =A0 =A0 plot &outvar._mean*sex =3D weight ;
> run;- Hide quoted text -
>
> - Show quoted text -

missing a semicolon after the first line?
If not that, what's the error message?
0
Reply Reeza 3/24/2011 12:06:25 AM

4 Replies
672 Views

(page loaded in 0.101 seconds)

Similiar Articles:













7/23/2012 11:40:33 AM


Reply: