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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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