由买买提看人间百态

topics

全部话题 - 话题: totalobs
(共0页)
t****e
发帖数: 25
1
来自主题: Statistics版 - two sas adv questions
1.
** sashelp.prdsale has more than 100 observations
%macro test;
data out;
set sashelp.prdsale nobs=totalobs;
if totalobs>10 then do;
%let rc=high; end;
else do; %let rc=low; end; run;
%mend;
%let rc=Before Execution;
%put &rc;
why is the result low?
2.
libname A 'SAS library reference';
libname F 'SAS library reference';
options fmtsearch=(A F.X);
what is the second location searched for formats?
The tutorial says
work.formats->library.formats->A.formats->F.X
why is the answer work.formats as
y*********4
发帖数: 76
2
来自主题: Statistics版 - 请问一道SAS ADV中的题目
第80题:
%let rc=Begin;
%macrotest;
data out;
set sashelp.prdsale nobs=totalobs;
if totalobs>10 then do;
%let rc=high;
end;
else do;
%let rc=low;
end;
run;
%mend;
%let rc=Before Execution;
%test
The data set SASHELP.PRDSALE has 50 obs, what is the value of the variable
RC when the macro finishes exectuion?
答案是A,可是怎么也想不通为什么是A呢?
D******n
发帖数: 2836
3
来自主题: Statistics版 - 请教一个SAS问题,感谢!
%let startobs=1;
%let step=4;

data a2;
do pickit=&startobs to totalobs by &step;
set a1 point=pickit nobs=totalobs;
output;
end;
stop;
run;
o******6
发帖数: 538
4
来自主题: Statistics版 - [合集] 求教一道Advanced SAS
☆─────────────────────────────────────☆
jstmj2002 (Jeff) 于 (Mon Mar 9 04:22:10 2009) 提到:
%let rc=Begin;
%macro test;
data out;
set sashelp.prdsale nobs=totalobs;
if totalobs>10 then do;
%let rc=high;
end;
else do;
%let rc=low;
end;
%mend;
%let rc=Before Excution;
%test
the data set sashelp.pdrsale has 50 observations. What is the value of the
variable RC when the macro finishes excution?
A. low
B. high
C. Begin
D. Before Excution
Answer is A.
Why not B?
☆────────────
w*******n
发帖数: 469
5
来自主题: Statistics版 - 问个SAS题目,
80. The following SAS program is submitted:
%let rc = Begin;
%macro test;
data out;
set sashelp.prdsale nobs = totalobs;
if totalobs > 10 then do;
%let rc = high; end; else do;
%let rc = low; end; run;
%mend;
%let rc = Before Execution;
%test
The data set SASHELP.PRDSALE has 50 observations. What is the value of the
variable RC when the macro finishes execution?
A.low
B.high
C.Begin
D.Before Execution
为什么不是B?
o**********a
发帖数: 330
6
照书抄了一段代码,works
data b;
do i=1 to 20;
randomrec=ceil(ranuni(0)*totalobs);
set a point=randomrec nobs=totalobs;
output;
end;
stop;
run;
proc print data=b;
run;
s*********e
发帖数: 944
7
来自主题: Statistics版 - 请问SAS ADV 130中74 和80题
74. The following SAS program is submitted:
%macro one(input);
%two
%put the value is &date;
%mend;
%macro two;
data _null_;
call symput('date', '12SEP2008');
run;
%mend;
%let date = 31DEC2006;
%one(&date)
What is the result when the %PUT statement executes?
A.A macro variable DATE with the value 12SEP2008 is retrieved from the
global symbol table.
B.A macro variable DATE with the value 31DEC2006 is retrieved from the
global symbol table.
C.A macro variable DATE with the value 12SEP2008 is retri... 阅读全帖
s******3
发帖数: 57
8
来自主题: Statistics版 - sas题目恳请前辈指点!!
新手入门, 应该是道很简单的题目, 可就是没绕出来, 为什么value of macro
variable rc 是low而不是high哪?
data a;
input age;
datalines;
12
12
13
35
36
37
;
run;
%macro test;
data b;
set a nobs=totalobs;
if totalobs > 5 then do;
%let rc = high;
end;
else do;
%let rc = low;
end;
run;
%mend;
&test
s******3
发帖数: 57
9
来自主题: Statistics版 - sas题目恳请前辈指点!!

谢谢大侠的指点, 能解释一下这道题考察的要点是什么吗? 为什么以下程序(仍用原始
数据库a) 仍然不能产生'low' value 哪? dataset a only contains 6 observations
so ELSE statement should be executed.....
%macro test;
data out;
set a nobs = totalobs;
%if totalobs > 10 %then %do;
call symput ('rc','high');
%end;
%else %do;
call symput ('rc','low');
%end;
run;
%mend;
%test
%put value of rc is &rc;
g****y
发帖数: 188
10
来自主题: Statistics版 - 求教2道sas advance题目,包子答谢。
Q17:
Given the SAS data set ONE:
ONE
DIVISION SALES
A 1234
A 3654
B 5678
The following SAS program is submitted;
Data _null_;
Set one;
By division;
If first.division then
Do;
%let mfirst=sales;
end;
run;
What is the value of the macro variable MFIRST when the program finishes
execution?
A. 1234
B. sales
C. 5678
D. null
我用程序跑过,确实是B. 但为什么不是C呢,想不明白。
Q80:
The following SAS program is submitted:
%let rc=Begin;
%macro test;
data out;
set sashelp.prdsale nobs = to... 阅读全帖
w********e
发帖数: 944
11
来自主题: Statistics版 - 请帮忙看3道SAS题。
1) D
只有在已经存在local symbol table的前提下,SYMPUT才产生local macro;否则,SYMPUT
产生的macro var在global symbol table中.
2)A
%letcompile时生成macro变量. data step执行时的logic是
if totalobs > 10 then do;
end;
else do;
end;
(共0页)