11-27-2016 10:16 AM
I have used proc freq on several variables cross referencing a year variable:
Proc Freq data=have;
Instead of the standard proc freq output, which stacks Freq, Col Percent, Row percent, etc., I'd like to have a table that joins the freq and Col percent into a single cell (or at least appear that way visually). Here is an example hand keyed from excel. I'd like to have sas output it in the format I need, rather than reentering the sas output into excel each time.
|Male||25 (12.5%)||50 (25%)||75 (37.5%)||90 (45%)||100 (50%)|
|Female||175 (87.5%)||150 (75%)||125 (62.5%)||110 (55%)||100 (50%)|
11-27-2016 12:39 PM
11-27-2016 05:05 PM
There isn't a default way to do this, you need to create some custom code to generate the table you want.
Program it once in SAS, if you're interested in writing the code look up a Cynthia Zender Paper called creating complex reports.
If you just wanr code, look up Summary tables in lexjansen.com, there are a lot of written papers on this topic.
11-27-2016 10:22 PM
In order to create a complex report, First PROC SQL, then PROC TRANSPOSE. proc sql; create table temp as select sex,age,cats(count(*),'(', put( count(*)/(select count(*) from sashelp.class where sex=a.sex) ,percent7.2), ')') as value from sashelp.class as a group by sex,age ; quit; proc transpose data=temp out=want prefix=age; by sex; var value; id age; run; proc print noobs;run;