문제

Suppose I have the following data set:

data people;
    input name $ age;
    datalines;
Timothy 25
Mark 30
Matt 29
;
run;

How can I change the age of a particular person? Basically, I want to know how to specify a name and tell SAS to change that person's (observation's) age value.

도움이 되었습니까?

해결책

The simple case:

data want;
set people;
if name='Mark' then age=31;
run;

You can change it in the same dataset a number of ways:

proc sql;
  update want 
    set age=31 
    where name='Mark';
quit;


data people;
set people;
if name='Mark' then age=31;
run;


data people;
modify people;
if name='Mark' then age=31;
run;

etc.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top