DATA Step, Macro, Functions and more

Trouble with macro that converts datasets into datasteps

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 77
Accepted Solution

Trouble with macro that converts datasets into datasteps

I'm trying to convert a sample dataset and its been giving me this error. Not quite sure what I typed wrong:

 

 
 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 WARNING: Apparent invocation of macro DATA2DATASTEP not resolved.
 61         
 62         %data2datastep(samplemonthanalysis,mydata,,100);
            _
            180
 
 ERROR 180-322: Statement is not valid or it is used out of proper order.
 
 63         
 64         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 77         

Accepted Solutions
Solution
‎03-16-2017 04:32 AM
Super User
Posts: 5,091

Re: Trouble with macro that converts datasets into datasteps

Do you know where the file data2datastep.sas is stored?

 

Here are a couple of additional possibilities for what went wrong.

 

Should your program contain an OPTIONS SASAUTOS= statement that was inadvertently omitted? 

 

Did your EG session try to work with other macros that were not found, before encountering this error?  (This situation can be overcome by just starting a new EG session.)

View solution in original post


All Replies
Super User
Super User
Posts: 7,413

Re: Trouble with macro that converts datasets into datasteps

That error is telling you that the macro is never defined.  You either need to have it in code before the call (i.e. a %macro ... %mend; before the code) or %include "..."; another file which does contain that macro definition - again, before you try to use it.

Solution
‎03-16-2017 04:32 AM
Super User
Posts: 5,091

Re: Trouble with macro that converts datasets into datasteps

Do you know where the file data2datastep.sas is stored?

 

Here are a couple of additional possibilities for what went wrong.

 

Should your program contain an OPTIONS SASAUTOS= statement that was inadvertently omitted? 

 

Did your EG session try to work with other macros that were not found, before encountering this error?  (This situation can be overcome by just starting a new EG session.)

Frequent Contributor
Posts: 77

Re: Trouble with macro that converts datasets into datasteps

It seems that a simple reloading of a new session helped with it. Thanks!

Super User
Posts: 6,963

Re: Trouble with macro that converts datasets into datasteps

Just repeat the steps you succesfully used when we solved https://communities.sas.com/t5/Base-SAS-Programming/Filtering-out-entries-that-do-not-have-a-certain...

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 122 views
  • 0 likes
  • 4 in conversation