BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
DavidPhillips2
Rhodochrosite | Level 12

  In SAS 9.2

  

I am converting a series of similar temporary table creation blocks into a macro.   I figured out how to write the macro with the
exception of where one table contains one more column than another.  I need to be able to pass a blank value into
a macro that won’t throw off my SQL create table statement.

  

For the column I want I found that I can use

%MyMacro(%str(four_digit_year varchar(4),));

  

I am not sure what I can use if I want to include a null.  Eg.

  

%MyMacro(null)

  

It seems that I can’t use “”

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

Passing a null value should be easy:

%MyMacro ()

View solution in original post

4 REPLIES 4
DavidPhillips2
Rhodochrosite | Level 12

The same idea would be useful here.  If I could feed in a blank &group into a
template.

proc template; 

    define statgraph TotalGraph;

      dynamic TITLE1 TITLE2;

   begingraph;

     entrytitle halign=left TITLE1;

     entrytitle TITLE2;

        layout overlay / xaxisopts =(label = ' ') yaxisopts =(label = ' ' linearopts=(viewmin=0)) walldisplay=(fill);

          seriesplot x=FOUR_DIGIT_YEAR y=students_enrolled   / &group

name='a' index=index display=all

    ROLENAME=(Year=ACADEMIC_PERIOD_DESC Level=&enrRepTy)

      TIP=(Year Level Y) tiplabel=(Year='Academic Term' Y='Students Enrolled' Level ='Level') datalabel=students_enrolled;

        endlayout;

      endgraph;

    end;

  run;



Astounding
PROC Star

Passing a null value should be easy:

%MyMacro ()

DavidPhillips2
Rhodochrosite | Level 12

Worked for me.  If you have a method that accepts three parameters and you feed it two SAS feeds only two parameters.  Apparently Polymorphism is not included in SAS.

Astounding
PROC Star

It's not difficult to overcome:

%MyMacro (A,,C)

The first parameter receives a value of A, the second is null, and the third is C.  It might be easier to understand if you switch from positional parameters to keyword parameters, though.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 2293 views
  • 0 likes
  • 2 in conversation