2016-02-11 88 views
1

我运行下面的代码:PROC格式的/ proc制表误差

ods listing close; 
ods pdf file = "D:\work.pdf"; 

proc format; 
value MS 1 = "Married - Spouse Present" 
     2 = "Married - Spouse Absent" 
     3 = "Widowed" 
     4 = "Divorced" 
     5 = "Seperated" 
     6 = "Never Married"; 

value Sex 1 = "Male" 
     2 = "Female"; 

value Race 1 = "White" 
     2 = "Black" 
     4 = "Asian"; 

value Hispanic 1 = "Hispanic"; 

value Age (multilabel); 

    16 - 19 = "16 to 19 years" 
    20 - 24 = "20 to 24 years" 
    25 - 54 = "25 to 54 years" 
    55 - 64 = "55 to 64 years" 
    16 - 85 = "Total, 16 years and over" 
    20 - 85 = "20 years and over" 
    25 - 85 = "25 years and over" 
    55 - 85 = "55 years and over" 
    65 - 85 = "65 years and over" 
    ; 
quit; 

proc tabulate data = Final; 
format age age.; 
class Age/mlf; 
class Race Hispanic_NonHispanic Marital_Status Full_Part_Time_Status Sex Year; 
var Multi_Job; 
table Age Race Hispanic_nonhispanic Marital_Status Full_Part_Time_Status, Sex*year*Multi_Job All/printmiss; 
format Race Race. Hispanic_nonHispanic Hispanic. Marital_Status MS. Sex Sex.; 
run; 
ods pdf close; 
ods listing; 

,但我得到了以下错误消息:

ods listing close; 
481 ods pdf file = "D:\work.pdf"; 
NOTE: Writing ODS PDF output to DISK destination "D:\work.pdf", printer "PDF". 
482 
483 proc format; 
484  value MS 1 = "Married - Spouse Present" 
485    2 = "Married - Spouse Absent" 
486    3 = "Widowed" 
487    4 = "Divorced" 
488    5 = "Seperated" 
489    6 = "Never Married"; 
NOTE: Format MS has been output. 
490 
491 value Sex 1 = "Male" 
492    2 = "Female"; 
NOTE: Format SEX has been output. 
493 
494 value Race 1 = "White" 
495    2 = "Black" 
496    4 = "Asian"; 
NOTE: Format RACE has been output. 
497 
498 value Hispanic 1 = "Hispanic"; 
NOTE: Format HISPANIC has been output. 
499 
500 value Age (multilabel); 
NOTE: Format AGE has been output. 
501 
502 16 - 19 = "16 to 19 years" 
    ............so on 

ERROR: Write Access Violation In Task (TABULATE) 
Exception occurred at (679B8D96) 
Task Traceback 
Address Frame  (DBGHELP API Version 4.0 rev 5) 
679B8D96 053BF9EC 0001:00057D96 sasxkern.dll 
679A0070 053BFAA8 0001:0003F070 sasxkern.dll 
679788B2 053BFB3C 0001:000178B2 sasxkern.dll 
66FC6323 053BFB4C 0001:00005323 sassfm01.dll 
66FCD034 053BFBC8 0001:0000C034 sassfm01.dll 
66FDD32B 053BFC28 0001:0001C32B sassfm01.dll 
66FCBDC6 053BFCC8 0001:0000ADC6 sassfm01.dll 
66FC386E 053BFCEC 0001:0000286E sassfm01.dll 
661217DD 053BFF58 0001:000007DD sastabul.dll 
67E223EE 053BFF74 0001:000113EE sashost.dll 
67E26DE0 053BFF88 0001:00015DE0 sashost.dll 
7638338A 053BFF94 kernel32:BaseThreadInitThunk+0x12 
772D9A02 053BFFD4 ntdll:RtlInitializeExceptionChain+0x63 
772D99D5 053BFFEC ntdll:RtlInitializeExceptionChain+0x36 

NOTE: The SAS System stopped processing this step because of errors. 
NOTE: There were 546 observations read from the data set WORK.FINAL. 
NOTE: PROCEDURE TABULATE used (Total process time): 
    real time   0.02 seconds 
    cpu time   0.03 seconds 

5 22 ods pdf close; 
NOTE: ODS PDF printed no output. 
    (This sometimes results from failing to place a RUN statement before the  ODS PDF CLOSE 
    statement.) 
523 ods listing; 

我在做什么错误?我也尝试过对年龄段的教练队伍进行(多标签未分类),但它仍然无法正常工作。不知道我做错了什么,我会很感激一些帮助。

回答

3

对于您的年龄格式,您在行尾有额外的分号。

value Age (multilabel); 

删除它,你应该没问题。

+0

傻我:谢谢Reeza! – user2916331