실행코드
proc print data= cert.Addresses; # ZIpcode 추출을 위한 데이터 확인
run;

data work.Senario8;
set Cert.Addresses;
Zipcode = substr(state, 3,5);
state = substr(state,1,2);
run;
proc print data=work.senario8;
where zipcode = '85069';
run;
proc freq data= work.senario8 order=freq;
tables State ;
run;
정답
data work.Senario8;
set Cert.Addresses;
Q. Extract the 5-digit ZIP codes from the State variable and store them in the ZipCode variable.
Q. Extract the two letters from the State variable and store them in theState variable.
Zipcode = substr(state, 3,5);
state = substr(state,1,2);
run;
Q. Which observation contains ZipCode 85069?
proc print data=work.senario8;
where zipcode = '85069'; # ' ' 주의
run;

Q. Create one-way frequency table using the variable State.
proc freq data= work.senario8 order=freq; # How many states have the frequency number 4? # 빈도로 내림차순 정렬
tables State ;
run;

'SAS > Scenario' 카테고리의 다른 글
| Scenario 1 (0) | 2022.12.25 |
|---|---|
| Scenarie 10 (0) | 2022.11.06 |
| Scenario 9 (1) | 2022.11.06 |
| scenario 7 (0) | 2022.11.06 |
| Scenario 6 (0) | 2022.11.06 |