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)

     )

)

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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