DATA Step, Macro, Functions and more

MACRO Broken

Posts: 24

MACRO Broken

options mprint mlogic;
%macro type(data);
data &data;
      set astc.&data;
%mend type;
%type (ppa_astc_cms1500_2013);
Super User
Posts: 13,942

Re: MACRO Broken

Please provide exactly what happens that makes you think the macro is broken.


And paste the result of the Log into a code box opened using the forum {I} menu icon. It is important to paste into a code box as the message window reformats some of the error and warning messages and those often provide something that points to offending code errors.


The Input function wants an informat to apply when attempting to do what ever to the variable data_yr so you should have gotten an error.


Other possible problems may exist but we need to see the log for that.


Super User
Posts: 6,935

Re: MACRO Broken

MACRO language isn't broken  Rather, your SAS language program is broken.  The INPUT function requires two arguments, and you have only supplied one.  It is best to follow the usual rule:  Get the program working without any macro language, and then turn the working code into a macro.

Super User
Posts: 10,600

Re: MACRO Broken

The only thing broken is your data step coding skills, as others have already mentioned Smiley Wink


Since no SAS/STAT procedures are involved, I moved this thread to Base SAS Programming, where it belongs.

Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Ask a Question
Discussion stats
  • 3 replies
  • 4 in conversation