BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Bulleride
Obsidian | Level 7

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

1 ACCEPTED SOLUTION

Accepted Solutions
mohamed_zaki
Barite | Level 11

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.

View solution in original post

4 REPLIES 4
mohamed_zaki
Barite | Level 11

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.

Bulleride
Obsidian | Level 7
Thanks a lot Zaki 🙂
lxn1021
Obsidian | Level 7

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;

Bulleride
Obsidian | Level 7
Thanks 🙂 This helps me.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1422 views
  • 2 likes
  • 3 in conversation