[SAS] sas if문과 substr함수를 이용하여 관측치 일부분 수정하는 방법
sas에서 if문과 substr함수를 이용하여 관측치 일부분 수정하는 방법을 알아보자. 먼저 샘플데이터가 필요하므로 ace라는 간단한 데이터셋을 생성하였다. [코딩과정] data ace1; set ace; new_a=a; if substr(new_a,1,1)='A' then substr(new_a,6,1)=1 ; else if substr(new_a,1,1)='B' then substr(new_a,6,1)=2; if substr(new_a,1,1)='A' then substr(new_a,1,1)=0; else if substr(new_a,1,1)='B' then substr(new_a,1,1)=0; run; [설명] a변수를 new_a라는 변수로 하나 더 생성 한것은 한눈에 비교하기 쉽고자 생성하였다. ..
2014. 2. 21.