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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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