DATA Step, Macro, Functions and more

#BYVAL(variable) and other BY statement variable directives

Reply
Respected Advisor
Posts: 3,777

#BYVAL(variable) and other BY statement variable directives

The BY statement variable directives can be used in many places other than TITLE statement where they were first introduced.

I wrote some code (some sort of macro thing) where a variable can contain #byval(variable) and I replace that with the BY value using VVALUEX, and TRANSTRN etc.   Of course I could have used another syntax but I don't like to invent my own, where there exists a perfectly good one.

Seems like there should be a way to use what has already been done by SAS to support this kind of replacement,  I was thinking a function might exist but did not find one.

Super User
Posts: 5,082

Re: #BYVAL(variable) and other BY statement variable directives

I'm not as familiar with this as I should be, but ...

I would imagine that ODS templates can take care of this.

SAS Super FREQ
Posts: 8,743

Re: #BYVAL(variable) and other BY statement variable directives

Hi:

ODS DOCUMENT has some automatic variables and I know that TAGSETS.EXCELXP has implemented some BY group support for #BYVAL/#BYVAR/#BYLINE, but as far as I know, it is only documented here in the TITLE statement: SAS(R) 9.4 Statements: Reference, Second Edition -- so your approach of using VVALUEX, etc might be the most flexible.

cynthia

Ask a Question
Discussion stats
  • 2 replies
  • 176 views
  • 0 likes
  • 3 in conversation