본문 바로가기

SAS/Scenario

scenario 7

실행코드

libname cert 'C:/folders/mypath/cert/';     # ERROR: Libref CERT is not assigned. 오류 해결
data work.scenario7;
set cert.Temp18;
format Day date9.;
Month = month(day);
run;

proc freq data=work.scenario7;
tables HighTemp;
run;

proc means data=work.scenario7;
  class month;
  var AvgHighTemp AvgLowTemp;
run;


proc print data=work.scenario7;
var HighTemp day;
run;

 


정답


data work.scenario7;
set cert.Temp18;

 

Q. Format the Day variable so that the date appears as 01JAN2018.
format Day date9.;     # 날짜 형식 지정

 

Q. Use a function to create a variable named Month that is equal to numeric value of the month of  the Day           variable. For example, if the month is January, Month=1,  if the Month is Febuary, Month=2m and so on.

Month = month(day);
run;

 

 

Q. Create a one-way frequency table using the variable HighTemp
proc freq data=work.scenario7;
tables HighTemp;
run;

 

Q.Use PROC MEANS to calculate the mean and standard deviation for the variables AvgHighTemp and AvgLowTemp by the new Month variable.
proc means data=work.scenario7;
  class month;       # month 별로 평균 계산
  var AvgHighTemp AvgLowTemp;
run;

 

Q. What is the frequency for a  HighTemp on January 12, 2018?
proc print data=work.scenario7;
var HighTemp day;
run;

 

 

 

 

 

'SAS > Scenario' 카테고리의 다른 글

Scenario 1  (0) 2022.12.25
Scenarie 10  (0) 2022.11.06
Scenario 9  (1) 2022.11.06
Scenario 8  (0) 2022.11.06
Scenario 6  (0) 2022.11.06