Good morning. I am having an issue with proc tabulate (at least I think that's my best option on how to proceed). The tabulate code I have works perfectly except I need to add two columns after the row total column. Both new columns need to be either a lookup value or a value from proc format and both are based on the total points per row. You can see from below that I have the proc tabulate written and it works great. I've also written the proc format just in case that's my best option. I'm just not sure how to put the proc format into play, or even if I can? The "HAVE" is missing two columns at the end. The "WANT" shows the two columns with the correct values.
Thank you very much. I'd sure appreciate any help or direction.
PS: The proc tabulate comments are for my benefit, they're not intended to explain this group how to use proc tabulate: I'm sure no one but me needs that. 🙂
proc format; value earned_level 0 - 15 = 'Not Enough Points' 16 - 75 = '$8.00' 76 - 79 = '$24.00' 80 - 85 = '$26.00' 86 - 106 = '$30.00' 107 - 127 = '$34.00' 128 - 148 = '$38.00' 149 - 169 = '$42.00' 170 - 190 = '$46.00' 191 - 211 = '$50.00' 212 - 232 = '$54.00' 233 - 253 = '$58.00' 254 - 274 = '$62.00' 275 - 295 = '$66.00' 296 - 316 = '$70.00' 317 - 337 = '$74.00' 338 - 358 = '$78.00' 359 - high= '$82.00'; value less_value 0 - 15 = 'Not Enough Points' 16 - 75 = '$87.60' 76 - 79 = '$22.80' 80 - 85 = '$24.70' 86 - 106 = '$28.50' 107 - 127 = '$32.50' 128 - 148 = '$36.10' 149 - 169 = '$39.90' 170 - 190 = '$43.70' 191 - 211 = '$47.50' 212 - 232 = '$51.30' 233 - 253 = '$55.10' 254 - 274 = '$58.90' 275 - 295 = '$62.70' 296 - 316 = '$66.50' 317 - 337 = '$70.30' 338 - 358 = '$74.10' 359 - high= '$77.90'; run;
ods listing close; options missing = ' ' orientation= 'landscape' papersize='letter' topmargin= 1in bottommargin= 0.5in rightmargin= 0.5in leftmargin= 0.5in; ods Excel file= "\\<<file_Path>>\pay_project_&SYSDATE..xlsx" options(sheet_interval = 'none' sheet_name = 'Summary' frozen_headers = '2' center_horizontal = 'yes' suppress_bylines = 'yes' absolute_column_width = '10, 30, 15, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12');
proc tabulate data = met_10 style = [background=beige font_size=2.0] order = data; /* Class must agree with table although table can contain things class does not.*/ /* Classlev lets you set attributes for class variables since the class statement will not allow styles.*/ /* Multiple classlev statements are allowed. This way you can set different variables to different styles.*/
class id_number name work_date PositionPoints / style=[font_size=2.0]; classlev work_date / style=[background=DMSWHITE /*DMSGRAY*/ font_size=2.0 cellwidth = 1000%]; classlev PositionPoints / style=[background=DMSWHITE /*DMSGRAY*/ font_size=2.0 textalign=center cellwidth = 1000%];
var points_paid;
/*All sets totals for the columns. Misstext gives a blank for missing data instead of a zero.*/ table id_number = 'SID '*name*PositionPoints ALL={label='Total' /*s=[just=center]*/}, (work_date = 'Date' ALL='Total Points') * (points_paid = ' ') * f=4.0 / misstext = ' ' style=[font_size=2] box = {label = ' '};
/*This removes the redundant statistic identifier in the table.*/ /*Ex. this removes the word "Sum" from the table headers.*/ keylabel sum= ' ' N= ' '; title1 " TITLE 1"; title2 "Summary: Points Earned"; footnote1 "Source: Source File &sysdate."; run;
ods Excel close; ods listing;
HAVE:
Date
Total Points
01NOV2021
02NOV2021
03NOV2021
04NOV2021
05NOV2021
08NOV2021
09NOV2021
10NOV2021
11NOV2021
12NOV2021
15NOV2021
16NOV2021
17NOV2021
18NOV2021
19NOV2021
22NOV2021
23NOV2021
24NOV2021
25NOV2021
26NOV2021
29NOV2021
30NOV2021
SID
Name
Position Points
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
396
100
NAME 1
18
200
NAME 2
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
196
16
16
16
16
16
16
16
16
16
128
300
NAME 3
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
396
400
NAME 4
14
14
14
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
336
500
NAME 5
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
396
600
NAME 6
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
396
700
NAME 7
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
396
800
NAME 8
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
352
900
NAME 9
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
396
950
NAME 10
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
396
Total
936
952
934
934
934
934
934
934
912
912
948
948
948
948
966
966
966
966
950
950
950
990
21000
WANT:
Date
Total Points
01NOV2021
02NOV2021
03NOV2021
04NOV2021
05NOV2021
08NOV2021
09NOV2021
10NOV2021
11NOV2021
12NOV2021
15NOV2021
16NOV2021
17NOV2021
18NOV2021
19NOV2021
22NOV2021
23NOV2021
24NOV2021
25NOV2021
26NOV2021
29NOV2021
30NOV2021
EARNED_LEVEL
LESS VALUE
SID
Name
Position Points
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
396
100
NAME 1
18
$82.00
$77.90
200
NAME 2
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
196
$50.00
$47.50
16
16
16
16
16
16
16
16
16
128
$38.00
$36.10
300
NAME 3
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
396
$82.00
$77.90
400
NAME 4
14
14
14
Not Enough Points
Not Enough Points
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
336
$74.00
$70.30
500
NAME 5
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
396
$82.00
$77.90
600
NAME 6
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
396
$82.00
$77.90
700
NAME 7
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
396
$82.00
$77.90
800
NAME 8
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
352
$78.00
$74.10
900
NAME 9
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
396
$82.00
$77.90
950
NAME 10
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
18
396
$82.00
$77.90
Total
936
952
934
934
934
934
934
934
912
912
948
948
948
948
966
966
966
966
950
950
950
990
21000
... View more