08-29-2016 03:17 PM - edited 08-29-2016 04:03 PM
Trying to produce a table that is exactly as shown. Can this been done with Proc Format and only one other procedure? Or do I need to setup the dataset to get the look at want when using something like proc tabulate?
Characteristic is the variables names and the Group is the variable values. (N is the counts and % is the percent of Characteristic)
Update: Proc Format is taken care of. The second image is what I got so far. I need the varable names in a seperate column to the left just like the from the first image.
08-29-2016 03:32 PM
08-29-2016 03:50 PM
It seems to me that you need 3 different formats:
(1) for gender, (2) for age group, (3) for employment
Usually a format usage is to convert or display a text instead of a code,
but I don't see codes in your table.
Anyway, you may try use or addapt next proc format:
proc format lib=work; /* you can use another library */
value $gender /* $ for chracter format */
'F' = 'Female'
'M' = 'Male'
2 = '20s'
3 = '30s'
6 = '60+'
other = '??' /* undefined */
'Full' = 'Full Time'
'Part' = 'Part Time'
Having the formats, you can use Proc Tabulate (or other procedures, depending on your dataset)
to displaty the data in the format you show. For more help - attach an example of your data or dataset.
08-29-2016 03:54 PM
You can do it solely with Proc Tabulate and formats. This is the easier method.
Proc Freq is another option as well with a bit of manipulation. You would add the formats for the variables into the proc freq.
*Run frequency for tables; ods table onewayfreqs=temp; proc freq data=sashelp.class; table sex age; run; *Format output; data want; length variable $32. variable_value $50.; set temp; Variable=scan(table, 2); Variable_Value=strip(trim(vvaluex(variable))); keep variable variable_value frequency percent cum:; label variable='Variable' variable_value='Variable Value'; run; *Display; proc print data=want(obs=20) label; run; Sign up for free