簡體   English   中英

我的 SAS 代碼出現錯誤,我需要幫助嗎?

[英]I get an error on my SAS code could I have assistance?

當我運行我的代碼時,我收到一個錯誤:錯誤 180-322:語句無效或使用順序不正確。 我想創建一個帶有輸入 ID、默認值、學生的表。

這是我的示例代碼。 我可以讓人看看我的代碼嗎?

代碼:

data have;
input ID  default student 
cards;
(1) yes    yes   
(2) Yes    No   
(3) NO    Yes   
(4) No     No   

;
run;

這是我得到的錯誤代碼:

 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 72         
 73         data have;
 74         input ID  default student
 75         cards;
 76         (1) yes    yes
            _
            180
 ERROR 180-322: Statement is not valid or it is used out of proper order.
 
 77         (2) Yes    No
 78         (3) NO    Yes
 79         (4) No     No
 80         
 81         ;
 82         run;
 
 ERROR: No DATALINES or INFILE statement.
 NOTE: The SAS System stopped processing this step because of errors.
 WARNING: The data set WORK.HAVE may be incomplete.  When this step was stopped there were 0 observations and 4 variables.
 WARNING: Data set WORK.HAVE was not replaced because this step was stopped.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds

輸入語句沒有分號來標記結束。 因此,您正在讀取一個名為 CARDS 的變量作為 INPUT 語句的一部分。 因此,您的數據行被視為生成錯誤消息的更多 SAS 命令。

一旦你解決了這個問題,你還需要修復你的 INPUT 語句。 您不能將(1)之類的字符串讀取為數字。 但是 ID 變量通常永遠不會在算術中使用,所以只需將其設為字符變量即可。 yesYes這樣的字符串也不能被讀取為數字。

data have;
  input ID $ default $ student $;
cards;
(1) yes    yes   
(2) Yes    No   
(3) NO    Yes   
(4) No     No   
;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM