BookmarkSubscribeRSS Feed
twildone
Pyrite | Level 9

Hi...I am trying to insert the number and name inside the header using the byval() and it doesn't seem to work. Can this be done and used with the Column statement? Thanks.

 

ODS PDF FILE="%sysfunc(pathname(project))\&FILENAME Report (&rundate).PDF" STYLE=JOURNAL NOTOC BOOKMARKGEN=NO BOOKMARKLIST=NONE STARTPAGE=NOW;

OPTIONS NOQUOTELENMAX;

PROC REPORT DATA=FINALDATASET NOWD HEADLINE HEADSKIP MISSING ps=43 ls=108
  style(report)={frame=box just=CENTER}
 STYLE(header)={font_weight=bold background=lightgrey font_face=Arial 
  font_size=8pt borderwidth=1px bordercolor=black just=CENTER}
 STYLE(COLUMN)={background=white font_face=Arial font_size=7pt borderwidth=1px
  bordercolor=black just=CENTER}
 STYLE(LINES)={JUST=C FONT_WEIGHT=BOLD FONT_SIZE=11PT};
 WHERE CH_Number ="&CH_Number"
 AND CH_Name ="&CH_Name";
BY CH_Number CH_Name;

COLUMN ("CH Number: #BYVAL(CH_Number) CH Name: #BYVAL(CH_Name)" LEVEL TOTAL_COST NUMBER_PURCHASES);
BY CH_Number CH_Name NOTSORTED;
 DEFINE LEVEL / DISPLAY 'LEVEL' STYLE(COLUMN)={JUST=LEFT};
 DEFINE TOTAL_COST / DISPLAY 'TOTAL COST' FORMAT=DOLLARr12.2 STYLE(COLUMN)={TAGATTR='format:$#,##0.00' JUST=RIGHT};
 DEFINE NUMBER_PURCHASES / DISPLAY 'NUMBER PURCHASES' STYLE(COLUMN)={TAGATTR='format:#,##' JUST=RIGHT};
RUN;

2 REPLIES 2
Ksharp
Super User

Can you post a Screen Snap and a sample data to explain your question?

If you want use #byval ,firstly you need specify :

options nobyline;

And also you could try :

#BYVAL1

#BYVAL2

Cynthia_sas
SAS Super FREQ
Hi: #BYLINE/BYVAL/#BYVAR will ONLY work in a TITLE statement. I see that you are trying to use them in a COLUMN statement. That will not work. Did you read the documentation on the use of #BYVAL???

You already have Macro variables for &CH_Number and &CH_Name.

KSharp is correct that to use the special BY variable tokens in a TITLE statement you usually need the NOBYLINE option -- but you do not have a TITLE statement.

Some of your options don't make sense, either for ODS PDF.. PROC REPORT options like HEADLINE, HEADSKIP, PS and LS are LISTING only options and are ignored by ODS PDF (and all the other ODS destinations).

cynthia

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 930 views
  • 0 likes
  • 3 in conversation