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

Hi guys,

 

I'm trying to assign individual titles to multiple PROC MEANS outputs in the macro as shown below. Any idea how to achieve proc means output has proper TITLEs after the names of datasets? Right now, all proc mean outputs are produced to:

DATA FOR &NAME

 

%LET NAME=&TAB;
PROC MEANS DATA=&AGE_TAB MIN MAX MAXDEC=2 MEAN MEDIAN;
VAR N_BLOCK;
TITLE 'DATA FOR &NAME';
RUN;

 

%SYMDEL;
%MACRO MODELS(TAB,TAB1,BLOCK_TAB,AGE_TAB);
PROC SQL;
CREATE TABLE &TAB1 AS SELECT 
...
QUIT;

PROC SQL;
CREATE TABLE &BLOCK_TAB AS
SELECT FIPS, AGECAT,SUM(OUTCOME) AS N_BLOCK
FROM &TAB1
GROUP BY FIPS,AGECAT;
QUIT;

PROC SQL;
CREATE TABLE &AGE_TAB
...FROM &BLOCK_TAB QUIT; %LET NAME=&TAB; PROC MEANS DATA=&AGE_TAB MIN; VAR N_BLOCK; TITLE 'DATA FOR &NAME'; RUN; %MEND MODELS; %MODELS(Oral_Pharynx ,Oral_Pharynx_U ,B_Oral_Pharynx ,AGE_Oral_Pharynx );

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26
title "Data for &name";

Use double-quotes, not single quotes, when you are working with a macro variable.

--
Paige Miller

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26
title "Data for &name";

Use double-quotes, not single quotes, when you are working with a macro variable.

--
Paige Miller
Cruise
Ammonite | Level 13
wow, now I KNOW! thank you.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 909 views
  • 0 likes
  • 2 in conversation