• 【sas sql proc】case end


    在sql中增加case可以增加数据处理的灵活性,注意结尾的end

     1 proc sql outobs=10;
     2     title 'this is an example of sql and case';
     3     select wangnei,date,
     4             case
     5             when 200901<=date<=200903 then 'first'
     6             when 200904<=date<=200906 then 'second'
     7             else 'else'
     8             end as season
     9     from mysas.mmsone
    10     where date<=200912;
    11 quit;

     ---------sas 9.3 sql procedure user's guide page 35 or (49/418)

     在where字句后还可以加上许多operator

    any all between-and contains exists in isnull is missing like =* 

    in

     1 proc contents data=mysas.ifthen; 
     2 run;
     3 proc print data=mysas.ifthen (firstobs=1 obs=10);
     4 run;
     5 proc sql outobs=10;
     6     title 'this is a instance of in';
     7     select * from mysas.ifthen
     8     where date in(200901,200902)
     9     order by shen descending;
    10 quit;

    between and

    1 proc sql outobs=10;
    2     title 'this is a try of between and';
    3     select * from mysas.ifthen
    4     where date between 200905 and 201001
    5     order by shen dscending;
    6 quit;

    like

    1 proc sql outobs=50;
    2     select * from &dataset
    3     where  subporduct_code like 'z%' or subporduct_code like 'XX____';
    4 quit;

     在where筛选条件中对于排序文本也可以用大于小于的逻辑来判断:eqt gtt ltt get let net.

  • 相关阅读:
    erlang中的图片下载
    erlang进程监控:link和monitor
    如何在linux centos下安装git(转)
    mnesia的脏写和事物写的测试
    关于proplists:get_value/2 与lists:keyfind/3 的效率比较
    mnesia的脏读和事物读的测试
    扒一扒P2P风控的底牌(转)
    ejabberd源码流程梳理
    Erlang的系统限制
    mark
  • 原文地址:https://www.cnblogs.com/colipso/p/2916295.html
Copyright © 2020-2023  润新知