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;
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)
)
)
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)
)
)
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.
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.