如何设置主键 | SAS工作室

Amb*_*thi 2 sas

我正在尝试在 SAS 上设置主键,但我不断收到下面提到的错误。任何帮助都会很棒!

第一个片段是代码,接下来是错误。

/*Primary Key*/ /*Defines the unique key*/

Proc datasets lib=work;
modify WORK.FinAdvMaster;
ic create primary key(FinAdvID);
PROC PRINT DATA=WORK.FinAdvMaster; RUN;**strong text**
Run Code Online (Sandbox Code Playgroud)

我得到的错误 -

 96         /*Primary Key*/ /*Defines the unique key*/
 97         
 98         Proc datasets lib=work;
 99         modify WORK.FinAdvMaster;
                   _________________
                   22
                   201
 ERROR 22-322: Expecting a name.
 ERROR 201-322: The option is not recognized and will be ignored.
 100        ic create primary key(FinAdvID);
 NOTE: Enter RUN; to continue or QUIT; to end the procedure.

Run Code Online (Sandbox Code Playgroud)

Stu*_*ski 5

work.从您的修改语句中删除。该lib=选项指定库。这是一个怪癖proc datasets

proc datasets lib=work;
    modify FinAdvMaster;
        ic create primary key (FinAdvID);
quit;
Run Code Online (Sandbox Code Playgroud)

请注意,如果您重新创建数据集,此密钥将被销毁。