We need to see the source data; please provide an example, in text form, ideally as a data step with datalines, and also an example for the expected report.
Post SAS code by using the "little running man" button; for other structured text (e.g. logs), use the </> button.
@Gauri123-56 What your pdf shows is not a table but a report.
You will first need to do some training before you are able to produce such a report.
Google: What is a SAS table
A report is the presentation/printing of the data stored in a table in some tabular form.
Looking at your pdf the most likely SAS procedure to use is Proc Report. You would also need to format your data so it presents/prints the way you want it to.
Unlike your subject line suggests there is no SAS Macro language required for such a report. Don't even go there before you're familiar with the SAS data step language and the "foundation" set of SAS procedures like Proc Report.
@Gauri123-56 wrote:
Yes I have this code using proc report but I want to do this using
macros...
SAS macro language is used to dynamically generate SAS language syntax for execution. SAS macro langue is not suited nor meant for report writing.
@Gauri123-56 wrote:
Yes I have this code using proc report but I want to do this using
macros...
Bullshit. Macros are for creating dynamic code, not for creating reports. As others have already suggested, you need to first become deeply familiar with data step programming and the use of essential procedures (SORT, REPORT, MEANS, FREQ, TABULATE, SQL, TRANSPOSE, to name just a few) before you can even think about macro programming.
And if you are already at the step where you have working code and want to make it dynamic, you need to show that code, and which parts of it need to be made dynamic, and the information on which the dynamics are based (e.g. a dataset which contains control information).
If new to SAS programming, I suggest that you talk a calss (e.g. Programing 1 - free online option is available).
https://support.sas.com/edu/schedules.html?crs=PROG1&ctry=SE
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.