BookmarkSubscribeRSS Feed
Anthony1
Calcite | Level 5

Hi,

I am trying to figure out how to correctly comment each parameter of my own macros so that others will understand what they should input. An example of this can be seen below:

 

%macro analyse(analysis_type /**/,dataset_in /**/,...);

 

When these comments are populated the macro is now:

 

%macro analyse(analysis_type

/*

There are currently 2 options for this parameter: Count, and earnings.
Count: A simple count for the specified variables.
Earnings: Calculates statistics based on earnings and split using the specified variables.

*/ , 

dataset_in /*Dataset for analysis*/,

...);

 

For this macro i want something like the following description for analysis_type to show up when entering this parameter in the macro:

 

There are currently 2 options for this parameter: Count, and earnings.
Count: A simple count for the specified variables.
Earnings: Calculates statistics based on earnings and split using the specified variables.

But this is how SAS outputs it:

There are currently 2 options for this parameter: Count, and earnings.Count: A simple count for the specified variables.Earnings: Calculates statistics based on earnings and split using the specified variables.

 

The problem is that SAS automatically sends the description to the next line which is something i want to have control over.

In short i would like to have a similar description format as would be seen when hovering over the 'means' keyword for example.

 

Thank you.

5 REPLIES 5
Quentin
Super User

Just curious, are you in EG or Studio?

 

I assume it's the IDE that is doing all of this magical parsing of code comments and converting it to hover text.  I guess for control over where line breaks are in hover you would need a special character to introduce line breaks, or for it to honor line breaks like:

 

%macro try (var=/*I am line 1.
                  I am line 2.
                */ 
          ) ;
%mend try ;

I don't have latest EG, but I'd be surprised if it does what you want.  If not, I would suggest putting in a ballot item.  

 

The Boston Area SAS Users Group is hosting free webinars!
Next up: Rick Wicklin presents Ten Tips for Effective Statistical Graphics (with SAS code) on Wednesday March 26.
Register now at https://www.basug.org/events.
Anthony1
Calcite | Level 5

I am using SAS Enterprise Guide.

The example that you have created is more or less what i have in my code. So when written in the way you have it, everything is just bundled into one line until a natural line break is reached. I'm guessing there is some sort of special character that i have not seen that does this. I am unfamiliar with a ballot item would you have a link to a description of them? 

Thank you.

Quentin
Super User
The SASware Ballot is a way for users to submit ideas for enhancements to SAS. There is a community here for it:
https://communities.sas.com/t5/SASware-Ballot-Ideas/idb-p/sas_ideas . Also, you might try posting this question in the EG community, as it's more about EG than SAS programming. The EG community is: https://communities.sas.com/t5/SAS-Enterprise-Guide/bd-p/sas_eg
The Boston Area SAS Users Group is hosting free webinars!
Next up: Rick Wicklin presents Ten Tips for Effective Statistical Graphics (with SAS code) on Wednesday March 26.
Register now at https://www.basug.org/events.
Tom
Super User Tom
Super User

I don't understand the question.  Are you talking about some GUI tool that is display your comments?  Or just the program editor?

 

It is hard to tell how your code is formatted since you did not use the INSERT SAS CODE button to enter the code.  But in general your code style looks fine. However you have made the mistake of hiding the commas between parameters at the end of the line. Place them at the beginning where humans can see them.

%macro analyse
/*  Overall description of the macro itself  */
(analysis_type  /* Count: A simple count for the specified variables. */
                /* Earnings: Calculates statistics based on earnings and split */
                /* using the specified variables. */
,dataset_in     /* Dataset for analysis */
,...
);
Anthony1
Calcite | Level 5

Apologies for not inserting my code this is my first time posting.

 

The code as i have it in my editor is as follows:

 

%macro analyse(analysis_type 	
/*
There are currently 2 options for this parameter: Count, and Earnings
Count: A simple count of graduates by the var_list variables. 
Earnings: Calculates statistics based on earnings and split using the specified variables
*/
,dataset_in 	/*Dataset for analysis*/ 		 	
,...
);

<Macro code here>

%mend;

I'm trying to use the programme editor to output a well formatted description of each parameter as the user enters it. I will provide my own description and want them to be spaced out legibly so that it is as easy to read as when a user hovers over the SAS 'MEANS' function, for example.

 

I have tried the way you suggested but it will only show the first line of the description.

Thank you.

sas-innovate-white.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Early bird rate extended! Save $200 when you sign up by March 31.

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 5 replies
  • 1414 views
  • 1 like
  • 3 in conversation