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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: