BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
annasulkko
Calcite | Level 5

"Write a macro program named ‘HistAndStats’ which may be used to summarize a numeric variable from any data set.The macro should contain the 1 parameter: ‘Stats’ to specify summary statistics.  Include default statistics of N, MEAN, and STDDEV."

 

How do you set the parameter 'Stats' to the summary statistic results? 

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User
%macro HistAndStats(stats=N MEAN STDDEV);

Defines the macro with a parameter called stats, and also defines a default value for it (which will be set if the macro is called without a parameter).

To really make this macro useful, it should also contain parameters for dataset and variable name.

View solution in original post

2 REPLIES 2
Kurt_Bremser
Super User
%macro HistAndStats(stats=N MEAN STDDEV);

Defines the macro with a parameter called stats, and also defines a default value for it (which will be set if the macro is called without a parameter).

To really make this macro useful, it should also contain parameters for dataset and variable name.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 868 views
  • 0 likes
  • 2 in conversation