QUESTION:The contents of the SAS data set PERM.JAN_SALES are listed below: VARIABLE NAME TYPE idnumcharacter variable sales_datenumeric 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;
put idnum sales_date : mmddyy 10.;
run;
B. libname perm 'SAS-data-library';
data_null_;
set perm.jan_sales;
put idnum sales_date : mmddyy 10.;
run;
C. libname perm 'SAS-data-library';
data_null_;
set perm.jan_sales;
put idnum sales_date : mmddyy 10. dlm = ',';
run;
D. libname perm 'SAS-data-library';
data_null_;
set perm.jan_sales;
put idnum sales_date : mmddyy 10. dsd = ',';
run;
Ans – B
None.
To write to a file you need a DATA step with a FILE statement and a PUT statement.
So they are all wrong.
C and D are wrong for that plus that DSD and DLM are not specification parameter of the put statment but the File statments.
After that you need to be aware of the differeance between DLM and DSD and which will let you have the delimiter you specify.
Writing a SAS Dataset To a Text File
So this questions is copied wrong.
None.
To write to a file you need a DATA step with a FILE statement and a PUT statement.
So they are all wrong.
C and D are wrong for that plus that DSD and DLM are not specification parameter of the put statment but the File statments.
After that you need to be aware of the differeance between DLM and DSD and which will let you have the delimiter you specify.
Writing a SAS Dataset To a Text File
So this questions is copied wrong.
None of the four options is correct. The correct one should be
data _null_;
set Jan_sales;
file "E:\SAS\Jan_sales.txt" dlm=",";
put idnum sales_date:mmddyy10.;
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.