By admin | September 9, 2009

SAS Certified Base Programmer 123 Questions (31)

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 : mmddyy 10.;
run;


B.

libname perm 'SAS-data-library';
data_null_;
    set perm.jan_sales;
    file 'file-specification' dlm = ',';
    put idnum sales_date : mmddyy 10.;
run;


C.

libname perm 'SAS-data-library';
data_null_;
    set perm.jan_sales;
    file 'file-specification';
    put idnum sales_date : mmddyy 10. dlm = ',';
run;


D.

libname perm 'SAS-data-library';
data_null_;
    set perm.jan_sales;
    file 'file-specification';
    put idnum sales_date : mmddyy 10. dsd = ',';
run;

5 comments | Add One

  1. admin - 09/9/2009 at 1:22 pm

    B

  2. Deepak - 08/12/2011 at 3:35 am

    One doubt: Is it not necessary to put $ for character variable (idnum) in put statement ?

  3. sun - 02/12/2012 at 9:32 am

    @2 Deepak. not necessary to put $ in put statement.

  4. chuck - 07/31/2012 at 9:21 pm

    No need for another $ value in the put statement. IDNUM inherits $ from the set statement.

  5. himanshu - 02/28/2013 at 12:59 pm

    @deepak, yes this is not necessary to put $ symbol for character value in put statement..

Leave a Comment

Leave a Reply

Your email address will not be published.