I need to create a demographic summary table. Since I'm doing this for the first time, I'm looking for the reference that describes creating table with continuous and categorical variables explicitly (possibly with step by step coding). Any suggestions please?
Search LexJansen.com
And note that everyone defines demographic table differently, so you may need to customize things as needed.
It seems down right now, but should be up soon.
Or search on here, there's a lot of examples. John King has some great papers on this as well.
My first suggestion is to make sure your data is as clean as possible. Each field involved should have an agreed upon content and be in that form. For instance if Gender or Sex is a field is it allowed to be missing or something like "don't know" or "refused". If the values are supposed to be "Male" or "Female" then beware of case ( "male" "female"), abbreviations ("M" "F" or "m" "f").
Second is if you have continuous values like Age but want to report age groups to investigate custom formats so you can make changes without having to add multiple variables to your data for that purpose.
And if you are reporting percentages make sure everyone involved knows what the denominator(s) involved should be: All records or records with valid values.
Very likely questions will arise if the total counts for all Sexes, for example, don't match total counts for all ages.
@ballardw- My data is clean already. My problem here is the proper use of proc freq, proc transpose... things are required in proper order.
Could you provide a template of what your demographic table should look like?
I presume it will be a table of frequencies cross-classified by demographic variables If so, which vars? SEX,RACE,AGE_GROUP..... other vars like IMMIGRANT/NATIVEBORN, Education level?
Yes, It is like this:
Treatment A Treatment B Total
Sex
M 50 (10%) 100 (20%) 500 (100%)
F
Race
White
Asian
.
.
You can get close to this with a PROC TABULATE.
Assume you have a data set of individuals with variables SEX ("M" or "F"), Race ("White", "Asian").
Then you can
proc tabulate data=have noseps;
class age sex treatment;
tables age sex all, (treatment all)*(N pctn) / rts=10;
run;
which gives the layout you want, but is ugly. You can improve the appearance:
proc format ;
picture mypct low-high='00.0%';
run;
proc tabulate data=have noseps;
class age sex treatment;
tables age sex all, (treatment all)*(N=''*f=comma4.0 pctn=''*f=mypct5.1) / rts=10;
run;
And if you want better than that, I think you need to learn about PROC REPORT.
@mkeintz, I did following and did proc report with other variables. But could not calculate total.
Did you find the solution? Can u share the solution on how to create demographic table?
Hi:
I show one approach to create several tables/reports (for RTF output) in my paper, Creating Complex Reports http://www2.sas.com/proceedings/forum2008/173-2008.pdf (page 9).
TABULATE is another approach, but TABULATE does not give you as much control over break lines and spacing.
You'll find the programs that accompany the paper here: http://support.sas.com/rnd/papers/#RegUsers_2008 scroll down on the page for 2008 and look for the paper title.
This is just one idea. I second the idea of searching on www.lexjansen.com because the PharmaSUG and PhUSE presenters have talked a lot about producing these types of reports.
Cynthia
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.