실행 코드
# 데이터 확인
proc print data=Cert.Empdata;
run;
proc print data=Cert.Empdatu;
run;
proc print data=Cert.Empdatu2;
run;

%let Location=USA;
data work.FlightEmpData;
set cert.Empdata cert.Empdatu cert.Empdatu2;
where Country = "&Location" and salary >= 30000;
run;
proc sort data = work.FlightEmpData;
by descending Salary;
run;
proc print data=work.FlightEmpData;
run;

Proc Export data=work.FlightEmpData
outfile ='/folders/mypath/cert/flightempdata.csv'
dbms=csv
replace;
run;
정답
Q. Concatenate Cert.Empdata, Cert.Empdatu, Cert.Empdatu2 to create Work.FlightEmpData.
Q. Create a macro variable named &Location and set the value of this macro variable to USA
%let Location=USA; # macro variabl
data work.FlightEmpData;
set cert.Empdata cert.Empdatu cert.Empdatu2;
Q. Include only the observations whose value for Country is the value of the macro variable.
Q. Keep only observations whose salsary is $30000 or greater.
where Country = "&Location" and salary >= 30000;
run;
proc sort data = work.FlightEmpData;
Q. Sort the data by variable Salary in descending order.
by descending Salary;
run;
Q. Use PROC EXPORT to export the data to a CSV and save it as flightempdata.csv.
Proc Export data=work.FlightEmpData
outfile ='/folders/mypath/cert/flightempdata.csv'
dbms=csv
replace;
run;
Q. What is the size (in bytes) of the CSV file that you exported?

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