tabulate, sql. macro, plot 不考.
非常感谢tacoon,
(https://bbs.pinggu.org/thread-153203-1-1.html)
资料非常非常有用.
我在网上收集的题如下 (attachement 死活不working, 气死了, 只好这样发, 格式有点乱) 答案是我自己做的, 不一定对. 谢谢提供这些信息的朋友.
data work.test;
first='ipswich, England';
city=substr(first,1,7);
city_country=substr(first,1,7)!!', '!!'England';
run;
Q: which one of the following is the length of the variable city_country in the output data set?
A: 25.
Bank:
firstcapital 0.0718
directbank 0.0721
virtualdirect 0.0728
data newbank;
do year=1 to 3;
set banks;
capital+5000;
end;
run;
Answer: 1 observation 4 variable in data set newbank
Liu
Isbella
ireland
Lanei
where name like (_i%)
Answer: Liu
Dataset aaa has the following records
a b c
1 1 1
1 2 2
2 3 3
1 4 4
2 5 5
data temp.one one temp.two;
set aaa;
if a = 1 then output temp.one;
if a = 2 then output temp.two;
run;
Q: How many obs are in the datasets temp.one, one, temp.two respectively?
Answer: temp.one: 3 one: 0 temp.two: 2
data temp;
a = 'BAA';
a = tranwrd(a, 'AA', 'BBBBB')
run;
Q: What is the length and value of a?
A: 3, BBB
data temp;
a = 'BAA';
b = tranwrd(a, 'AA', 'BBBBB')
run;
Q: What is the length and value of b?
A: 200, BBBBBB
found = find('Ivy is a girl.', 'i')
Q: What is the value of found?
A: 5
And some questions about 'like', 'cat', 'catx', 'left', 'proc sort', the 'varnum' option
in 'proc contents', the 'tables' statement in 'proc freq', the 'crosslist' option in 'tables'.
do year=1 to 5;
do month=1 to 12;
x+month;
output;
end;
end;
Q: how many observation?
A: 60
do year=1 to 5;
do month=1 to 12;
x+month;
end;
end;
Q: how many observation?
A: 1
catx function
length of a variable when with substr(), trim(), scan() , tranwrd()
SET A (IN=a_in) B (IN=b_in); IF a_in and b_in;
Q: how many observations?
A: 0
Data _null_; SET a; PUT name $15.; RUN;
Q: where is the output?
A: Log
mdy(1,3,1960)=2 or 3? 2
difference between ORDER and GROUP in Proc Report
Suppse data set AA has 3 observations and 2 variables.
DATA BB;
DO i=1 to 3;
SET AA; /* Yes, SET is within the loop */
var3=var1+var2; /* var1 and var2 are the two variables in AA */
END;
RUN;
Q: how many observations and how many variable in BB?
A: 1 obs and 3 varaiables
Drop = And drop statement
array aaa{6} _temporary_; creates temporary arrays
[此贴子已经被作者于2007-7-24 8:02:59编辑过]