The SAS Output Delivery System and reporting techniques

Nested proc report column headings

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 133
Accepted Solution

Nested proc report column headings

Hi SAS Experts,

As soon as I paste in the line makred with   /*---1---*/ I get the error below:

                       _

                       22

ERROR 22-322: Syntax error, expecting one of the following: a name, ;, (, ',',

              _ALL_, _CHARACTER_, _CHAR_, _NUMERIC_. 

336                     ('MastBeef' ('EB' CATTLE_EB_N CATTLE_EB_P) ('SB'  CATTLE_SB_N

336      ! CATTLE_SB_P) ))

                       _

                       200

ERROR 200-322: The symbol is not recognized and will be ignored.

If I take the line out, all works fine. Why is that? Is there a limit on nesting?

proc report data=zus split='*';

COLUMNS MAIN_GR SUB_GR PARAMETER

             ('Beef' (

             ('Cattle' ('EB' CATTLE_EB_N CATTLE_EB_P) ('SB'  CATTLE_SB_N CATTLE_SB_P) ))

             ('Cow' ('EB' CATTLE_EB_N CATTLE_EB_P) ('SB'  CATTLE_SB_N CATTLE_SB_P) ))

            ('Cow' ('EB' CATTLE_EB_N CATTLE_EB_P) ('SB'  CATTLE_SB_N CATTLE_SB_P) ))    /*---1---*/

;

DEFINE MAIN_GR / ORDER'Main-*group';

DEFINE SUB_GR / ORDER'Sub-*group';

DEFINE CATTLE_EB_N / 'N';

DEFINE CATTLE_EB_P / 'P';

DEFINE CATTLE_SB_N / 'N';

DEFINE CATTLE_SB_P / 'P';

run;


Accepted Solutions
Solution
‎08-10-2015 04:57 AM
Super User
Super User
Posts: 7,392

Re: Nested proc report column headings

You appear to have a strange set of bracketing there.  If you put them on separate lines, you will see the first ( is closed before the last cow record, hence it will work fine to that point.  It is a good example of why Good Programming Practice is important, i.e. consistent casing, spacing, use new rows to split things up etc.:

('Beef'

     (

          ('Cattle'

                ('EB' CATTLE_EB_N CATTLE_EB_P)

                ('SB'  CATTLE_SB_N CATTLE_SB_P)

          )

     )           

     ('Cow'

          ('EB' CATTLE_EB_N CATTLE_EB_P)

          ('SB'  CATTLE_SB_N CATTLE_SB_P)

     )

)

     ('Cow'

          ('EB' CATTLE_EB_N CATTLE_EB_P)

          ('SB'  CATTLE_SB_N CATTLE_SB_P)

     )

)

View solution in original post


All Replies
Solution
‎08-10-2015 04:57 AM
Super User
Super User
Posts: 7,392

Re: Nested proc report column headings

You appear to have a strange set of bracketing there.  If you put them on separate lines, you will see the first ( is closed before the last cow record, hence it will work fine to that point.  It is a good example of why Good Programming Practice is important, i.e. consistent casing, spacing, use new rows to split things up etc.:

('Beef'

     (

          ('Cattle'

                ('EB' CATTLE_EB_N CATTLE_EB_P)

                ('SB'  CATTLE_SB_N CATTLE_SB_P)

          )

     )           

     ('Cow'

          ('EB' CATTLE_EB_N CATTLE_EB_P)

          ('SB'  CATTLE_SB_N CATTLE_SB_P)

     )

)

     ('Cow'

          ('EB' CATTLE_EB_N CATTLE_EB_P)

          ('SB'  CATTLE_SB_N CATTLE_SB_P)

     )

)

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 377 views
  • 0 likes
  • 2 in conversation