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.
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.
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.
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 */
,...
);
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.
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.
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.
Ready to level-up your skills? Choose your own adventure.