Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The first day of the test was January 23, 2012. Add the variable Date to the SAS

ID: 3046258 • Letter: T

Question

The first day of the test was January 23, 2012. Add the variable Date to the SAS data set and format it to look like this: 01/23/2012. (Do this using SAS code, not reading in new data.)

The previous code is

%let dirdata=/folders/myfolders/;

DATA tempArray;
INFILE "&dirdata.tempArray.csv" firstobs=2 DSD MISSOVER termstr=crlf;
INPUT temp1-temp24;
Array temp_F {24} temp1-temp24;
Array temp_C {24} temp_c1-temp_c24;
do i=1 to 24;
drop i;
temp_C(i) = 5/9*(temp_F(i) - 32) ;
temp_C(i)= round(temp_C(i),0.1);
end;
RUN;
proc print data=tempArray ;
run;

The file is:

temp1 temp2 temp3 temp4 temp5 temp6 temp7 temp8 temp9 temp10 temp11 temp12 temp13 temp14 temp15 temp16 temp17 temp18 temp19 temp20 temp21 temp22 temp23 temp24 21.5 17.5 23.7 28 29.9 34.5 34 35.2 38.8 41.7 38.6 42.7 20.4 17.4 24.1 28.4 29.6 34.7 29.6 35.7 36.6 36.7 36.9 40.7 21.8 23.6 28.5 23.8 31.6 28.8 37.5 33.2 30 34.5 44.9 43.7 16.6 24.2 22 28.1 30.6 31.7 29.9 32.7 33.1 37.2 36.7 41.9 19.7 21.3 24.9 25.2 26.4 31.6 37.1 29.8 33.3 39.4 40.1 44.1 21.4 26 21.4 24 27.2 29.2 36.7 39.4 37.1 41.9 43.2 43.6 18.9 21.3 25.3 28.8 24.1 31.5 36.1 38.4 38.3 39.5 40.9 47.4 24 23.3 29.8 27.2 34.2 31.3 31 32.5 32.7 36.9 43.3 47.5 21.5 19.7 22.1 26.7 24 29.6 32.6 34.1 38.1 34.7 38.3 36.1 18.5 18.8 27.5 28.6 30.4 32.1 29.5 32.3 36.4 38.8 39.8 41.8

Explanation / Answer

To create a new variable datewe will use the date constant as 'ddmmmyy'd as '23jan2012'd in the data step in the proc print step we will use the format statement with the format mmddyy10. to display the date as 01/23/2012

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote