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

Hi,

I was wondering if its possible to embed a parameter into the title statement.

I have the parameter

%let cur_monthend = 20110731 ;

and I want to have a title statement before my proc means something similar to ,

Title ' Summary Report &cur_monthend' ;

but of course the above doesnt work, the &cur_monthend comes out as a text, I was wondering if it was possible so that it uses the parameter to output the value so the title would look something like

"Summary Report 20110731"

Thanks for your help.

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Use double quotation marks, not single, macro variables will not resolve inside single quotation marks.

View solution in original post

2 REPLIES 2
Reeza
Super User

Use double quotation marks, not single, macro variables will not resolve inside single quotation marks.

MikeZdeb
Rhodochrosite | Level 12

Hi ... use double-quotes on the title ...

* hard coded;

%let cur_monthend = 20110731 ;

title "Summary Report &cur_monthend" ;

proc print data=sashelp.class (obs=1);

run;

Summary Report 20110731

Name      Sex    Age    Height    Weight

Alfred     M      14      69       112.5

You could make the code 'dynamic' ...


* changes with the day job is run;

data _null_;

call symputx('cur_monthend', put(intnx('month',today(), 0,'e'),yymmddn.));

run;

title "Summary Report &cur_monthend";

proc print data=sashelp.class (obs=1);

run;

Summary Report 20110831

Name      Sex    Age    Height    Weight

Alfred     M      14      69       112.5

from ...

http://www.datimpact.be/tips/finding-the-last-day-of-the-month-in-sas-using-intnx.php

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