Pages

Wednesday, May 15, 2013

concepts on DLM, DSD

The contents of the SAS data set PERM.JAN_SALES are listed below:

VARIABLE NAME TYPE
idnum character variable
sales_date numeric date value
A comma delimited raw data file needs to be created from the PERM.JAN_SALES data set. The SALES_DATE values need to be in
a MMDDYY10 form.
Which one of the following SAS DATA steps correctly creates this raw data file?

A. libname perm 'SAS-data-library';
data _null_;
set perm.jan_sales;
file 'file-specification' dsd = ',';
put idnum sales_date : mmddyy10.;
run;

B. libname perm 'SAS-data-library';
data _null_;
set perm.jan_sales;
file 'file-specification' dlm = ',';
put idnum sales_date : mmddyy10.;
run;

C. libname perm 'SAS-data-library';
data _null_;
set perm.jan_sales;
file 'file-specification';
put idnum sales_date : mmddyy10. dlm = ',';
run;

D. libname perm 'SAS-data-library';
data _null_;
set perm.jan_sales;
file 'file-specification';
put idnum sales_date : mmddyy10. dsd = ',';
run;
The correct answer is: B
concepts :-
DSD = ',' is invalid because by default DSD is a comma. If you use DSD alone it would work.

First, in put statement, $ sign for character variable, Idnum is not needed.
Ans, A is not correct as the default delimeter (,) for DSD is defined as dsd = ','. It is correct if it was used as: DSD
Ans C and D are not correct because of using the options dlm and dsd in PUT statement. They are the INFILE options

No comments:

Post a Comment