The contents of the raw data file TEAM are listed below:
--------10-------20-------30
Janice 10
Henri 11
Michael 11
Susan 12
The following SAS program is submitted:
data group;
infile 'team';
input name $15. age 2.;
file 'file-specification';
put name $15. +5 age 2.;
run;
Which one of the following describes the output created?
A. a raw data file only
B. a SAS data set named GROUP only
C. a SAS data set named GROUP and a raw data file
D. No output is generated as the program fails to execute due to errors.
Click Comment link to get answer
B
ReplyDeleteAns: C
ReplyDeleteThe correct answer is C
ReplyDeleteC
ReplyDeletei think the answer is D
ReplyDeleteas we are using list input and output ...and to input a character longer than 8 bytes needs to have a colon before format
data group;
infile 'team';
input name :$15. age :2.;
It does error however the file and data set are still created. mine ended up with 'Henri 11 ' was the only line.
DeleteAnswer is D
ReplyDeletecan anyone please explain. thanks
ReplyDeleteany explanation would be appreciated!!!
ReplyDeletethanks
infile and input statements are used to read data from raw data file. File and put statements are used to write data to raw data file. In our example later is happening, so a raw data file is created and as data step is creating a dataset (it is not data _null_), it will create an output dataset too. So the answer is C raw data file and group dataset. Hope that helps.
ReplyDeletethank you vikas
DeleteYEs,it did. Answer ( c ).
ReplyDeleteBut as it is creating GROUP and a raw data,
ReplyDeletein their input, put statements
doesn't the "name $15." place BOTH the name and age values of the orginal data as a single data into the name variable of the new data,file created?
and doesn't this lead to an error, leaving variable age with nothing?
it's a data error not a syntax error! so the program will produce the data set named GROUP and a raw data file, with some missing values.
ReplyDeletethe answer is C
The correct answer is c:
ReplyDeletedata group;
infile datalines;
input name $15. age 2.;
file 'c:\temp\borra.txt';
put name $15. +5 age 2.;
datalines;
Janice 10
Henri 11
Michael 11
Susan 12
;
run;
C is the answe
ReplyDeleteI ran the prog and checked the result. A dataset with only one observation was created with the value 'Henri 11' in the first variable, and the second variable was empty. A file was also created showing the other 3 missing observations pasted in the text file.
ReplyDeleteD
ReplyDeleteAns C.
ReplyDeleteSAS data set named GROUP and a raw data file is created - jus checked in SAS.
C
ReplyDeleteC
ReplyDeleteC .. data errors dont stop the step execution ... only syntax errors do. So the dataset and the file get created with erroneous data.
ReplyDeleteHere +5 indicates what?
ReplyDeleteit seems this is related to what I found in this link:
Deletehttp://support.sas.com/documentation/cdl/en/lestmtsref/63323/HTML/default/viewer.htm#n1spe7nmkmi7ywn175002rof97fv.htm
"This statement moves the pointer to column 23, writes a value of LENGTH in columns 23 through 26, advances the pointer five columns, and writes the value of WIDTH in columns 32 through 35:
put @23 length 4. +5 width 4.;
C
ReplyDelete