- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@ballardw- My data is clean already. My problem here is the proper use of proc freq, proc transpose... things are required in proper order.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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?
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set
Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets
--------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Yes, It is like this:
Treatment A Treatment B Total
Sex
M 50 (10%) 100 (20%) 500 (100%)
F
Race
White
Asian
.
.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set
Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets
--------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@mkeintz, I did following and did proc report with other variables. But could not calculate total.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Did you find the solution? Can u share the solution on how to create demographic table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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