s********1 发帖数: 54 | 1 Question(1)The following is my sas code: Who can tell me why it is wrong?
###############################
data temm;
length A B 3 X;
input A B X;
cards;
10 20 3
23 34 56
run;
#################################3
Error message:
##########################
78 data temm;
79 length A B 3 X;
-
22
1 1
-
352
ERROR 22-322: Expecting a numeric constant.
ERROR 352-185: The length of numeric variables is 3-8.
80 input A B X;
81 cards;
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.TEMM may be incomplete. When this step was
stopped there were 0
observations and 3 variables.
WARNING: Data set WORK.TEMM was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds
84 run;
#########################################################
Question(2)The following SAS program is submitted:
data WORK.TEMP;
length A B 3 X;
infile RAWDATA;
input A B X;
run;
########################################
Why is the above length of A is 3? rather than "Unknown"?
thank you!!! |
x**********0 发帖数: 163 | 2 For the first question, SAS expects you to assign a length for X
For the second question, if you run the proc contents, you will see that the
length for variable A is 3. Even thought there is an error
in the lenght statement, that is only for X. And X is still have length of 8.
I hope this is clear. |
H**********1 发帖数: 3056 | 3 I think you don't understand this:
LENGTH A B 3 =LENGTH (A B) 3
SO BOTH A B ARE DEFINED 3
【在 s********1 的大作中提到】 : Question(1)The following is my sas code: Who can tell me why it is wrong? : ############################### : data temm; : length A B 3 X; : input A B X; : cards; : 10 20 3 : 23 34 56 : run; : #################################3
|