BookmarkSubscribeRSS Feed
mkeintz
PROC Star

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

 

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
ChrisNZ
Tourmaline | Level 20

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

 

 

lihongamerica
Calcite | Level 5
Hi , can you explain in this put 'Retain ' (_all_) (=) ';' @;
what the (=) means?

Thanks
data_null__
Jade | Level 19

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.

Capture.PNG

 

 

 

 

Tom
Super User Tom
Super User

@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.

Capture.PNG


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.

lihongamerica
Calcite | Level 5

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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 20 replies
  • 27356 views
  • 8 likes
  • 7 in conversation