2010년 4월 6일 화요일

[PROC FREQ] OneWayFreqs output data set 생성하기

기본으로 제공되는 결과 양식을 조금 수정하여 보기 좋게 변경하는 예제입니다.


ods listing close;
ods output OneWayFreqs=outfreq;                                                  
                                                                                  
proc freq data=sashelp.class;                                                    
   tables age sex;                                                                
run;                                                                              
                                                                                  
ods output close;                                                                
ods listing;                                                                      
                                                                                  
proc print data=outfreq label;                                                    
run;                                                                              
                                                                                  
/* 테이블 양식 정리 */    
data allfreq;                                                                    
   retain table column_value;                                                    
   set outfreq;                                                                  
   keep table column_value frequency percent cumfrequency cumpercent;  

   table=scan(table,1,' ');  

   column_value=trim(left(vvaluex(table)));                                      
   label table='Table'                                                            
         column_value='Column_Value';                                            
run;                                                                              
                                                                                  
proc print data=allfreq label;                                                    
run;

댓글 없음: