%let out=/sas/output/file_name.csv;
filename dest hadoop "&out";
%ds2csv(data=input_table,labels=N,runmode=b,csvfile=out);
I have to create a csv file from dataset by only using ds2csv
log shows csv successfully generated but I am not able to find it in specified hadoop destination folder.
macro variable out is getting resolved correctly
should i not give csvfile=libref in ds2csv utility. What is the issue?
Hi,
Have you tried using dest as your last argument, e.g.:
%ds2csv(data=input_table,labels=N,runmode=b,csvfile=dest);
If this does not help then please share the log.
Thanks & kind regards,
Amir.
Edit: Replaced out with dest.
Hi,
Try using another parameter csvfref=dest (in place of csvfile=dest):
%ds2csv(data=input_table,labels=N,runmode=b,csvfref=dest);
Thanks & kind regards,
Amir.
Can you write to the HADOOP area just using a simple a data step? For example try making a file with 3 columns and one row of data.
data _null_;
file dest dsd;
put 'a,b,c';
put '1,2,3';
run;
If so then the issue is how %DS2CSV() is writing the file.
Can you just use PROC EXPORT instead to write the CSV file to HADOOP?
proc export data=input_table file=dest dbms=csv;
run;
You must use the correct macro variable reference:
%ds2csv(data=input_table,labels=N,runmode=b,csvfile=&out.)
The documentation of the macro can be found here
@Kurt_Bremser wrote:
You must use the correct macro variable reference:
%ds2csv(data=input_table,labels=N,runmode=b,csvfile=&out.)
The documentation of the macro can be found here
So that document say:
csvfile=external-filename
specifies the name of the CSV file where the formatted output is to be written. If the file that you specify does not exist, then it is created for you.
Note Do not use the CSVFILE argument if you use the CSVFREF argument.
csvfref=fileref
specifies the SAS fileref that points to the location of the CSV file where the formatted output is to be written. If the file that you specify does not exist, then it is created for you.
Note Do not use the CSVFREF argument if you use the CSVFILE argument.
So if they want to use the fileref DEST to write to HADOOP that was defined using the &OUT macro then they need to use CSVFREF parameter instead of CSVFILE parameter.
%ds2scv(...csvfref=dest)
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.