复习了一个多月,主要是看书(ADV SAS Prep Guide) 和听SAS 的在线课程(Proc SQL, Macro I 和 Macro II)。 书一定要认真读一遍,我是前边很用心,后边有点儿急躁。一分耕耘一分收获。我自己觉得Proc SQL 就比后边学的扎实。看书看不下去的时候听在线课程。主要考点在课程里都有提到,我个人觉得Macro II还是有一定深度的,我那几天有别的事情,没怎么好好听Macro II,感觉没有学到什么东西。
纠正一下
call symputx('Num', Statename) 这里Num是定义的macro所以不能在之前加&。
纠正一下之前关于
format search (library reference)的问题,其实很简单看下边的注解就知道正确答案了
If you specify FMTSEARCH=(ABC DEF.XYZ GHI), SAS searches for requested formats or informats in this order:
- WORK.FORMATS 
- LIBRARY.FORMATS 
- ABC.FORMATS 
- DEF.XYZ 
- GHI.FORMATS. 
 
If you specify FMTSEARCH=(ABC WORK LIBRARY) SAS searches in this order:
- ABC.FORMATS 
- WORK.FORMATS 
- LIBRARY.FORMATS 
 
分享一个考前根据63题自己写的SAS code(只有有些题目有code)。
*63 items for advanced sas;
*#3;
/*
data employee;
        input Name$ Dept$;
        datalines;
        Alan Sales
        Michelle Sales
        ;
run;
data newemployee;
        input Names$ Salary;
        datalines;
        Michelle 50000
        Paresh 60000
        ;
run;        
proc sql;
        select Name, Dept
        from employee
        where name = any 
        *here you can also use =any to replace in;
                (select Names
                from newemployee
                where salary>40000)
        ;
quit;                 
*/
*#4;
/*
data highway;
        input Steering$ speed$;
        datalines;
        absent 0-29
        absent1 0-29
        absent2 30-49
        absent3 30-49
        absent4 50+
        ;
run;        
libname ref '/folders/myfolders/sasuser.v94';
        data highway;
        set highway;
        run;
proc sql;
        select distinct Speed
                into :Groups separated by ','
        from highway;
quit;                
*#5 and 59, ERROR: Indexed data set cannot be sorted in place unless the FORCE option is used. 
;
proc sql;
create index steering on highway;
quit;
proc sort data=highway force;
        by steering;
run;        
*59. Here the data set name and new data have same name 'highway', so the index of steering is gone along with the variable steering.
I tried to change the data name to highway59, then the index of steering is still there.;
data highway;
        set highway (keep=steering speed rename=(steering=newvar));
run;
proc sort data=highway;
        by steering;
run;
*27;
data work.first;
 input common$ x y;
 datalines;
 a 10 21
 a 13 22
 a 14 23
 b 9  24 
 c 20 25 
 ;
run;
data work.second;
        input common$ y;
        datalines;
        a 1
        a 3
        b 4
        b 2
        
        ;
run;
data work.combine;
        set work.first;
        set work.second;
run;
proc print data=work.combine;
run;
*30;
%let product=merchandise;
%put the value is "&product";
proc print data=work.combine;        
title "the value is &product";
run;
*/
*31;
data work.one;
        input x$ y;
        datalines;
        a 10
        a 3
        a 14 
        b 9
        ;
run;
data work.two;
        input  sumy;
        datalines;
        36
        ;
run;                
data work.combine;
        if _n_ = 1  then set work.two;
        else set work.one;
run;
proc print;
run;
/*
*38;
%macro check(num=4);
        %let result=%eval(&num gt 5.1);
        %put result is &result;
%mend;
%check(num=10)        
*47;
options mlogic mprint;
%macro execute;
        %if &sysday=Thursday %then %do;
        proc print data=work.combine;
        run;
        %end;
        %put today is &sysday;
%mend execute;
%execute        
*55;
data work.one;
        input year qtr budget;
        datalines;
        2001 3 500
        2001 4 400
        2003 1 350
        ;
run;
data work.two;
        input year qtr sales;
        datalines;
        2001 4 300
        2002 1 600
        ;
run;
proc sql;
        select *
        from work.one as o
                outer join
                work.two as t
        on o.year=t.year
        ;
quit;
*/