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

Hi,

 

I have currently got the following code below, but can someone please help me change the text that I have currently got highlighted in red, so that the title for each month of my results will be included, so that it should say "February 2020 - Differences between open date and register" and "January 2020 - Differences between open date and register"? Thanks!

 

Code

%macro monthly_check(month_yyyy,startdt,enddt);

 

data &month_yyyy. ;

   set test;

   where "&startdt."d <= OPEN_DATE <= "&enddt."d;

   Difference = intck('MONTH',OPEN_DATE,REGISTER);

run;

 

proc freq data=&month_yyyy. ;

   title '&month_yyyy. - Differences between open date and register';

   table Difference;

run;

title;

 

%mend monthly_check;

 

%monthly_check(February2020,01Feb2020,29Feb2020);

%monthly_check(January2020,01Jan2020,31Jan2020);

 

1 ACCEPTED SOLUTION
2 REPLIES 2
Patrick
Opal | Level 21

For macro variables to resolve they need to be in double quotes.

%macro monthly_check(month_yyyy,startdt,enddt);
  data &month_yyyy.;
    set test;
    where "&startdt."d <= OPEN_DATE <= "&enddt."d;
    Difference = intck('MONTH',OPEN_DATE,REGISTER);
  run;

  title "&month_yyyy. - Differences between open date and register";
  proc freq data=&month_yyyy.;
    table Difference;
  run;
  title;
%mend monthly_check;

%monthly_check(February2020,01Feb2020,29Feb2020);
%monthly_check(January2020,01Jan2020,31Jan2020);

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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
  • 2 replies
  • 1282 views
  • 2 likes
  • 3 in conversation