BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Any idea what is wrong with this code?

array region{22} region_1 - region_22;
array ais{22} ais_1 - ais_22;
array trhead{22} trhead1-trhead22;
do i = 1 to dim(ais) ;
if region(i)='HEAD' then do trhead(i)=ais(i); end;
-
73
ERROR: The variable type of trhead is invalid in this context.
ERROR: Illegal reference to the array trhead.
ERROR 73-322: Expecting an =.

325 end;
3 REPLIES 3
deleted_user
Not applicable
missing semi-colon after the "then do"
Should be "then do;"
JasonDiVirgilio
Quartz | Level 8
It's syntax errors like this that I waste HOURS on ! Lol.
deleted_user
Not applicable
I was taught that rule 1 of SAS programming is "Where is the semicolon?"

I counsel people to reread their code and ensure that all between their semicolons is valid SAS code. I can't count the number of times that going back to rule 1 has allowed me to find an error in my own code.

That's my 8 farthings worth.

Kind regards

David
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
  • 3 replies
  • 1351 views
  • 0 likes
  • 2 in conversation