Economics & Deeplearning

질문 infile 본문

SAS/SAS 질문과 답변

질문 infile

이슈카 2016. 2. 21. 13:07

 1                  11111011101110111
 2                  11111110011111110
 3                  11111111111110111
 4                  00000000100011010

...                           ...

위와 같은 데이터를 불러들일 때 간단한 방법 없을까요?....

아래같이 일일이 지정하는거 말고~~~~

 

data a;                                                                                                                                
 infile  "D:\data\data1.dat" missover pad;                                                                                             
 input @1 id $2.                                                                                                                       
      @21 x1 1.                                                                                                                         
      @22 x2 1.                                                                                                                         
      @23 x3 1.                                                                                                                         
      @24 x4 1.                                                                                                                         
      @25 x5 1.                                                                                                                         
      @26 x6 1.                                                                                                                         
      @27 x7 1.                                                                                                                         
      @28 x8 1.                                                                                                                         
      @29 x9 1.                                                                                                                         
      @30 x10 1.                                                                                                                        
      @31 x11 1.                                                                                                                        
      @32 x12 1.                                                                                                                        
      @33 x13 1.                                                                                                                        
      @34 x14 1.                                                                                                                        
      @35 x15 1.                                                                                                                        
      @36 x16 1.                                                                                                                        
      @37 x17 1.                                                                                                                        
;                                                                                                                                      
run;

================================================================================


data temp;
infile cards;
input @1 id 2. @21 x $20.;
cards;
1 11111011101110111
2 11111110011111110
3 11111111111110111
4 00000000100011010
;
run;

data temp1;
set temp;
array k{17} x1-x17;
do i=1 to 17;
k[i]=substr(x,i,1);
end;
drop i x;
run;

Comments