Explanation: The WEEKDATEw. format writes SAS date values in the form day-of-week, month-name dd, yy (or yyyy), where dd is an integer that represents the day of the month. yy or yyyy is a two-digit or four-digit integer that represents the year. If w is too small to write the complete day of the week and month, SAS abbreviates as needed.
Question : Given the SAS data set PERM.STUDENTS:
PERM.STUDENTS NAME AGE ---------------- Allen 14 Alina 13 Babita 13 Kavel 14
The following SAS program is submitted:
libname perm `SAS data library'; data students; set perm.students; file `file specification'; put name $ age; (insert statement here) run;
The following double-spaced file is desired as output Allen 14 Alina 13 Babita 13 Kavel 14
Explanation: Put statement : Writes lines to the SAS log, to the SAS output window, or to an external location that is specified in the most recent FILE statement. Without Arguments : The PUT statement without arguments is called a null PUT statement. The null PUT statement writes the current output line to the current location, even if the current output line is blank releases an output line that is being held with a trailing @ by a previous PUT statement.
Question : For the first observation, what is the value of diff{i} at the end of the second iteration of the DO loop?
array wt{*} obs1-obs10; array diff{9}; do i=1 to 9; diff{i}=wt{i+1}-wt{i}; end;
Explanation: At the end of the second iteration, diff{i} resolves as follows: diff{2}=wt{2+1}-wt{2}; diff{2}=215-200 In the DO statement, you specify the index variable that represents the values of the array elements. Then specify the start and stop positions of the array elements. Example : Using the Iterative DO Statement without Infinite Looping In each of the following examples, the DO group executes ten times. The first example demonstrates the preferred approach. do i=1 to 10; ...more SAS statements... end; The next example uses the TO and BY arguments. do i=1 to n by m; ...more SAS statements... if i=10 then leave; end; if i=10 then put 'EXITED LOOP'; Example : Stopping the Execution of the DO Loop In this example, setting the value of the index variable to the current value of EXIT causes the loop to terminate. data iterate1; input x; exit=10; do i=1 to exit; y=x*normal(0); /* if y>25, */ /* changing i's value */ /* stops execution */ if y>25 then i=exit; output; end; datalines; 000 ;