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.
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.
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.
SAS is headed back to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team.
Interested in speaking? Content from our attendees is one of the reasons that makes SAS Innovate such a special event!
For SAS newbies, this video is a great way to get started. James Harroun walks through the process using SAS Studio for SAS OnDemand for Academics, but the same steps apply to any analytics project.
Find more tutorials on the SAS Users YouTube channel.