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

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;

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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

1 REPLY 1
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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)

     )

)

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
  • 1 reply
  • 1536 views
  • 0 likes
  • 2 in conversation