DATA Step, Macro, Functions and more

Reading raw files

Accepted Solution Solved
Reply
Contributor
Posts: 31
Accepted Solution

Reading raw files

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


Accepted Solutions
Solution
‎02-25-2016 12:58 PM
Super Contributor
Posts: 490

Re: Reading raw files

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


All Replies
Solution
‎02-25-2016 12:58 PM
Super Contributor
Posts: 490

Re: Reading raw files

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.

Contributor
Posts: 31

Re: Reading raw files

Thanks a lot Zaki Smiley Happy
Occasional Contributor
Posts: 17

Re: Reading raw files

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;

Contributor
Posts: 31

Re: Reading raw files

Thanks Smiley Happy This helps me.
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

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