DATA Step, Macro, Functions and more

a macro to generate summary statistics

Reply
Contributor
Posts: 36

a macro to generate summary statistics

Dear SAS communities,

I need to generate a table of summary statistics like this attached example.  Would like to use proc freq for categorical and proc ttest for continuous variables.  The flexibility of switching to other procedures such as proc glm or proc npar1way is even better.

 

Does any one know of a easy to use MACRO for this purpose (just plug in location of dataset, desired list of variables to compare, class)?

 

thanks a million!

 

PROC Star
Posts: 1,561

Re: a macro to generate summary statistics

[ Edited ]

 

Microsoft-formatted files have a built-in ability to carry unwanted and nefarious payloads.

 

It is very likely that no one will take the risk to look at your excel file.

Contributor
Posts: 36

Re: a macro to generate summary statistics

sorry about that, I have included a screenshot instead of the microsoft excel
Super User
Posts: 17,831

Re: a macro to generate summary statistics

I have a few, if you email me I can send you one. Not sure it's exactly what you want but should get you started. 

 

You can also look for papers on lexjansen.com. These are commonly called Table 1 or Table of characteristics. 

Contributor
Posts: 36

Re: a macro to generate summary statistics

thanks so much Reeza.  but how do I email you, sorry I am new to the SAS communities.


Screen Shot 2016-11-14 at 9.52.48 PM.png
Super User
Posts: 10,500

Re: a macro to generate summary statistics

Many users here don't want to download Excel files because of virus potential, others have such things blocked by security software. Also if you give us Excel we have to create a SAS data set and due to the non-existent constraints on Excel data cells the result we end up with may not have variables of the same type (numeric or character) and even values.

 

https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat...

has instructions on turning SAS data sets into data step code we can run to duplicate your data set.

 

Since your image post shows a p-value then you are apparently doing some test. What test would that be? Do you already have all those values and are just trying to show the table or do you need to generate the statistics and then show a table? If the later then you need to provide a much more detailed description of your existing data and what you are attempting to portray.

Ask a Question
Discussion stats
  • 5 replies
  • 312 views
  • 0 likes
  • 4 in conversation