169k views
1 vote
Which program contains an error?

a.
data stresstest (drop=timemin timesec);
set physical;
TotalTime=(Timemin*60)+Timesec;
run;
b.
proc print data=stressdata;
label TotalTime='Duration of Test';
drop TimeMin;
run;
c.
proc print data=stresstest (keep=TotalTime TimeMin);
label TotalTime='Duration of Test';
format TimeMin 5.2;
run;

1 Answer

0 votes

Final answer:

Program b contains an error as it uses the 'drop' statement within 'proc print', which is not correct usage in SAS. The 'drop' should be used within a 'data' step or dataset options,the correct option is C).

Step-by-step explanation:

The student has asked a question about identifying a program with an error within a SAS (Statistical Analysis System) code context. Analyzing the given programs, the first one (a) appears to create a new variable TotalTime correctly by using arithmetic on existing variables. The second program (b) is using proc print to display data and label a variable, and does correctly label TotalTime. However, it attempts to use the drop statement within the proc print, which should be used within a data step or in the set dataset options, not within the proc print.

The third program (c) displays a potential issue because the drop statement cannot be used within the proc print statement. The correct way to exclude TimeMin from the printed output is to include it only in the set dataset options, not within proc print. Additionally, the format statement is used correctly to specify the number of decimal places for the variable TimeMin in the printed table.

User Pepijn Schmitz
by
7.8k points