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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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