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

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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