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

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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