Building models with SAS Enterprise Miner, SAS Factory Miner, SAS Visual Data Mining and Machine Learning or just with programming

Regarding Error in SAS Macros

Reply
Contributor
Posts: 59

Regarding Error in SAS Macros

Dear All ,

I'm getting the error in the following macros please can anyone  able to give any solution for this?

i attached screen shot also for your reference.

Thanks a lot..

Regards,

ANil

data finfage; merge _cinage (in=a) crefage (in=b); by sex _agecat;  if a;

326      ageint = _agemos2-_agemos1; dage=agemos- _agemos1;

327

328  array l0  _llg  _mlg  _slg  _lht  _mht  _sht  _lwt  _mwt  _swt _lhc  _mhc  _shc  _lbmi

328! _mbmi  _sbmi;

329  array l1 _llg1 _mlg1 _slg1 _lht1 _mht1 _sht1 _lwt1 _mwt1 _swt1 _lhc1 _mhc1 _shc1 _lbmi1

329! _mbmi1 _sbmi1;

330  array l2 _llg2 _mlg2 _slg2 _lht2 _mht2 _sht2 _lwt2 _mwt2 _swt2 _lhc2 _mhc2 _shc2 _lbmi2

330! _mbmi2 _sbmi2;

331  do over l0; l0= l1 + (dage * (l2 - l1)) / ageint; end;

332

333  if agemos < 24 then _mbmi=.; *theres a valid value for 23.5 months! ;

334

335  %_zscore(length, _llg, _mlg, _slg, lgz, lgpct, _Flenz);

    -

    180

WARNING: Apparent invocation of macro _ZSCORE not resolved.

ERROR 180-322: Statement is not valid or it is used out of proper order.

336      %_cuts(_flenz, _bivlg, -5, 3);

337  %_zscore(height, _lht, _mht, _sht, stz, stpct, _Fstatz);

    -

    180

WARNING: Apparent invocation of macro _ZSCORE not resolved.

ERROR 180-322: Statement is not valid or it is used out of proper order.

338      %_cuts(_fstatz, _bivst, -5, 3);

339  %_zscore(weight, _lwt, _mwt, _swt, waz, wapct, _Fwaz);

    -

    180

WARNING: Apparent invocation of macro _ZSCORE not resolved.

ERROR 180-322: Statement is not valid or it is used out of proper order.

340      %_cuts(_fwaz, _bivwt, -5, 5);

341  %_zscore(headcir, _lhc, _mhc, _shc, headcz, headcpct, _Fheadcz);

    -

    180

WARNING: Apparent invocation of macro _ZSCORE not resolved.

ERROR 180-322: Statement is not valid or it is used out of proper order.

342      %_cuts(_fheadcz, _bivhc, -5, 5);

343  %_zscore(bmi, _lbmi, _mbmi, _sbmi, bmiz, bmipct, _Fbmiz);

    -

    180

WARNING: Apparent invocation of macro _ZSCORE not resolved.

ERROR 180-322: Statement is not valid or it is used out of proper order.

Super User
Posts: 19,862

Re: Regarding Error in SAS Macros

Posted in reply to anilgvdbm

If you're trying to call a macro from within a data step and use values from the data step then you need to use call execute instead of %.

See the second example.

In general, create a text string that has the %_cuts(...) and then pass that to call execute.

Super User
Super User
Posts: 7,076

Re: Regarding Error in SAS Macros

Posted in reply to anilgvdbm

The error message is saying that the macro that is being called is not defined.

Is this code you wrote yourself?  Where is the code that defines the macro?

Ask a Question
Discussion stats
  • 2 replies
  • 491 views
  • 0 likes
  • 3 in conversation