The macro language is for creating dynamic, reusable code. So you first need working base SAS code.
Please show that code, and indicate which parts need to be made dynamic.
@Gauri123-56 wrote:
Here this space between count and percentage I'm giving manually for each variable so i want to create macro for that which will give proper alignment for both character as well as numeric variables
That's great, but many of us will not download file attachments. Use the "Insert Photos" icon to show us a screen capture of what you want us to see. And please also provide the other information that we have requested.
Also, what does any of this have to do with macros?
"Alignment" is only relevant in reports. Your code does not produce a report. You will also not need a macro to get correct alignments in a report procedure.
Please post usable example data (data step with datalines, posted as code-text, NOT as a picture!) and the report layout you want to achieve (this may be a screenshot).
Agreeing with @Kurt_Bremser , you need working code without macros and without macro variables before you start macro writing. If you don't can't write working code without macros and without macro variables, then you can't write a macro that works. People sometimes avoid/ignore this advice, but honestly, you can't get anywhere if you avoid this advice. So show us working code without macros and without macro variables.
@Gauri123-56 wrote:
I want to create 2 different macros for getting proper alignment in tables of clinical sas like for count and percentage so that they will come with same alignment in final report.
Help will be appreciated😊
With out very explicit details, such as your data and the actual appearance of the report there really isn't any way to answer this.
HOWEVER, I have seen enough of these "count and percentage" requests over the years to say that if you want both to appear in ONE cell of a table, such as "123 (43.5%)" as a single value, that you will spend a great deal of effort trying to get anything to "align" nicely. Procs Report, Tabulate and Print, the basic tools for reporting, include alignment options for each cell of a report table. So if each value is alone in a cell you can get consistent alignment.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Follow along as SAS technical trainer Dominique Weatherspoon expertly answers all your questions about SAS Libraries.
Find more tutorials on the SAS Users YouTube channel.