Ʈ  |  Contact Us
 
Ȩ > SAS Tech & Tip > SAS Programming
Practice 2. ȿ Data-Step (1) 2010.01.12
MYSAS 8260 0
http://www.mysas.co.kr/SAS_tiptech/a_question.asp?b_no=960&gotopage=34&con=subject&keyword=&cmd=content&bd_no=05&gubun=

 
 

Practice2. ȿ Data Step (1)

 

  Intro

 


 
  ֿ 帰 ̴?

Ǯ ˴ϴ
. ̹ ֿ Data Step ˷帮ڽϴ.

츮 α׷ ϰ ϴ ٷ絵 ϰڽϴ
.

!! ׷ ?

 

 

  Pracitce. Must All statements execute for all observations?

 


 

   1.

 Ʒ ΰ Data step ̴ ϱ?

/*Data-Step  ex_1*/

Data oldmales;

 set sashelp.class;

        hwratio = height/weight;
     statement 1;
     statement 2;
     statement 3;
        

       
statement n;

     if sex = 'M' ;

 run;

 /*Data-Step  ex_2*/

 Data oldmales;

  set sashelp.class;

      if sex = 'M' ;

         hwratio = height/weight;
         statement 1;
         statement 2;
         statement 3;
          

         
statement n;

  run;

  ó :  õ ϰ  
            ġ ִ IF մϴ

 ó : IF IF ǿ ´
         IF õ մϴ

 

   2.

  и ϴ. ׷ óϴ ӵ ̴ մϴ.

  Ǽ Ǵ ๮ , Ǽ ְų Ͻ Ͽ Ǵ , ӵ ̰ Դϴ.

õ IF true 쿡 Ʒ ๮( Dataset ϴ ؼ) ϶ ǹ̰ ֽϴ. (Fail 쿡 翬 Ʒ ʰ !)

 

 

  Exercise

 

 

sashelp.class Ǽ õ or ̶ ϼ.

Class Ϳ sex ÷ Ͱ (‘M’)̰, height/weight 1 µ Data Step .
 
α׷ ڵϴµ ׸ ̴ϴ.
󸶳 ȭϿ α׷ ۼ ϴĿ , ð(Performance) ̰ ֽϴ.

* ÿ ˴ϴ.

 

 

  1ȸ Exercise  Դϴ.

 


%Let
Code = A B C D ;
%Let Desc = 100 200 300 400 ;

 data code(keep=code dec);
 
 length code $10 ;
 do i = 1 to 4;
     code =scan("&Code", i, ' ');
     dec=input(scan("&Desc", i, ' '), 8.);
 output;
 end;

run;
 

 

 

 

 
ڷ ۿ SAS KOREA. , ܹ մϴ

 
 
  [2018/09/07 9:06]
dec=input(scan("&Desc" i ' ') 8.); Ÿ
desc=input(scan("&Desc" i ' ') 8.);
޴ ȣ
޴ ȣ
 
 Practice 3. ȿ Data-Step (2)
 Practice 1. ũ ⺻