0
votes

I would like to insert blank columns and rows in a proc report. This is for copy-pasting purposes into excel, so hopefully it's possible to create actual blank columns and rows and not just spacing, but I'd like to learn about controlling spacing too.

(this is related to a previous question here which will be revised with a solution once I figure this out)

The previous step was to use proc summary to create a table with just the summary statistics that I would like to display in the table, to overcome the issue with using proc tabulate to compute percentages by multiple class variables missing values.

Here is the summary dataset:

data job; 
input dem $ year apply_count interviewed_mean hired_mean; 
datalines; 
Male    2012    288 0.15972 0.21739
Female  2012    61  0.09836 0.33333
Male    2013    279 0.19355 0.2963
Female  2013    59  0.25424 0.26667
Male    2014    293 0.18089 0.28302
Female  2014    61  0.27869 0.17647
Degree  2012    108 0.28704 0.19355
NoDeg   2012    241 0.08714 0.28571
Degree  2013    108 0.36111 0.28205
NoDeg   2013    230 0.13043 0.3
Degree  2014    124 0.23387 0.2069
NoDeg   2014    230 0.17826 0.29268
run; 

Here is the code I'm using for the report:

proc report data = job; 
    columns  dem (("Applied" apply_count) ("Interviewed" interviewed_mean) ("Hired" hired_mean)), (year); 
    define dem / group " ";
    define apply_count / analysis "" format = comma8.; 
    define interviewed_mean / analysis "" format = percent8.; 
    define hired_mean / analysis "" format = percent8.; 
    define year / across  ""; 
run; 

It's perfect except that I would like a blank column after each set of years so the final result would be:

        Applied         Interviewed     Hired   
        12  13 14       12  13 14       12  13 14
Degree  108 108 124     29% 36% 23%     19% 28% 21%
NoDeg   241 230 230     9%  13% 18%     29% 30% 29%

Female  61  59  61      10% 25% 28%     33% 27% 18%                                             
Male    288 279 293     16% 19% 18%     22% 30% 28%
1

1 Answers

1
votes

This is what I came up with. I don't know if it will cut and paste to Excel correctly.

data job; 
   input dem $ year apply_count interviewed_mean hired_mean; 
   select(first(dem));
      when('M','F') gr=1;
      otherwise     gr=2;
      end;
   datalines; 
Male    2012    288 0.15972 0.21739
Female  2012    61  0.09836 0.33333
Male    2013    279 0.19355 0.2963
Female  2013    59  0.25424 0.26667
Male    2014    293 0.18089 0.28302
Female  2014    61  0.27869 0.17647
Degree  2012    108 0.28704 0.19355
NoDeg   2012    241 0.08714 0.28571
Degree  2013    108 0.36111 0.28205
NoDeg   2013    230 0.13043 0.3
Degree  2014    124 0.23387 0.2069
NoDeg   2014    230 0.17826 0.29268
run; 

options missing=' ';
proc report data = job list; 
   columns  gr dem (("Applied" apply_count),year gap ("Interviewed" interviewed_mean),year gap ("Hired" hired_mean),year); 
   define gr  / group ' ' noprint;
   define dem / group " ";
   define apply_count / analysis "" format = comma8.; 
   define interviewed_mean / analysis "" format = percent8.; 
   define hired_mean / analysis "" format = percent8.; 
   define year / across  ""; 
   define gap / ' ' style={cellwidth=.25in};
   compute after gr;
      line ' ';
      endcomp;
   run; 

enter image description here