Your program works in modern versions of SAS. It might have been an issue in 9.22, but I don't know. SAS 9.22 shipped in early 2010;
there have been 7 releases of SAS/IML since 9.22.
To work around the issue, don't use the %INCLUDE statement. Instead, use the RESET STORAGE function to point to the storage library, as discussed in the article "Storing and Loading Modules." I don't have 9.22 to try it, but I think it will work.
BTW, in SAS 9.4, the SERIES subroutine was introduced, which does what you are trying to do. For examples of SAS/IML graphics in modern releases, see the documentation examples. If possible, I highly recommend upgrading to SAS 9.4 or later.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.