Excuse the lagged response.
I see a pleasing fastidious quality to the task of making arrays no bigger than necessary.
BUT ... (you knew there was a "but' coming, right?) in this particular case it doesn't optimize performance. There are no instances of looping through the superfluous elements in the array, nor is there any operational reference to the entire oversized array (like call missing or call sortc).
> in this particular case it doesn't optimize performance
True, but
array _s[10] _temporary_;
is not really satisfactory is it?
So what value do you set and forget? 999? 9999?
The performance impact of a large number of elements is low [as we have a _temporary_ array], but that fixed value is still a [small] flaw.
And as you point out, once the utility exists, it can be used anywhere, including in places where it matters for resource usage optimisation.
What did you find in the documentation?
1 data _null_;
2 set sashelp.class(obs=2);
3 put 'NOTE: ' (_all_)(=);
4 run;
NOTE: Name=Alfred Sex=M Age=14 Height=69 Weight=112.5
NOTE: Name=Alice Sex=F Age=13 Height=56.5 Weight=84
NOTE: There were 2 observations read from the data set SASHELP.CLASS.
@data_null__ wrote:
What did you find in the documentation?
1 data _null_; 2 set sashelp.class(obs=2); 3 put 'NOTE: ' (_all_)(=); 4 run; NOTE: Name=Alfred Sex=M Age=14 Height=69 Weight=112.5 NOTE: Name=Alice Sex=F Age=13 Height=56.5 Weight=84 NOTE: There were 2 observations read from the data set SASHELP.CLASS.
The trick with TRANSLATE() is not going to work if printing all of the variable names exceeds the line length of the file being written. Might as well just use the version that supports name literals all of the time.
Manly when I run one the data which gave me error,
It was after run retain, then showed this error
: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where the error has occurred.
ERROR 202-322: The option or parameter is not recognized and will be ignored.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.