Can anyone help me with the following?
proc export data=have
outfile="&output.want.dat"
dbms=DLM
replace;
run;
I have my libname created. But this one is not working
Your PROC EXPORT creates a text file with a .dat extension not a SAS7BDAT file.
If you want a SAS7BDAT file you place it into that library and the file is created. If you want a text file you use a PROC EXPORT and ensure you have the path correct.
"Export"/Save to a SAS7BDAT file to the myfolders folder.
libname myFiles "/folders/myfolders/";
proc copy in=work /*library of input files*/
out=myFiles; /*library of output files*/
select WANT; *dataset to copy is called want;
run;
Export to a text file - Tab (09x) delimited, if you want a different delimiter change the delimiter statement.
proc export data=sashelp.class
outfile = "/folders/myfolders/class.dat" dbms=dlm replace;
delimiter = '09'x;
run;
Make sure you code works before you add macro variables and then add the macro variables once it's working.
@abdulla wrote:
Can anyone help me with the following?
proc export data=have
outfile="&output.want.dat"
dbms=DLM
replace;
run;
I have my libname created. But this one is not working
In your example, have is already a sas7bdat file since it is in the work library.
If you want to copy it to a permanent library you can use proc copy, or just another data step.
libname dest "&output"; data dest.want; set have; run;
The export procedure for creating non-SAS files.
You asked to:
export dataset to a sas7bdat
SAS7BDAT is the extension for a SAS dataset.
What format do you want output, and where?
%let output = C:\temp\;
data have;
x = 1;
run;
proc export data=have
outfile="&output.want.dat"
dbms=DLM
replace;
run;
Is this what you are trying to do?
Is there anything further up the log that gives more information?
Did you change the line:
%let output = C:\Temp\
To a location that exists and that you have write permission too?
Yes, that code runs exactly like it is posted.
Are you making sure your path ends in a \ ?
If your code isn't working after this, post the exact code and log.
@abdulla wrote:
Yes. I made sure that. I will close my all files and run the data again. I will let you know it it works or not
Your PROC EXPORT creates a text file with a .dat extension not a SAS7BDAT file.
If you want a SAS7BDAT file you place it into that library and the file is created. If you want a text file you use a PROC EXPORT and ensure you have the path correct.
"Export"/Save to a SAS7BDAT file to the myfolders folder.
libname myFiles "/folders/myfolders/";
proc copy in=work /*library of input files*/
out=myFiles; /*library of output files*/
select WANT; *dataset to copy is called want;
run;
Export to a text file - Tab (09x) delimited, if you want a different delimiter change the delimiter statement.
proc export data=sashelp.class
outfile = "/folders/myfolders/class.dat" dbms=dlm replace;
delimiter = '09'x;
run;
Make sure you code works before you add macro variables and then add the macro variables once it's working.
@abdulla wrote:
Can anyone help me with the following?
proc export data=have
outfile="&output.want.dat"
dbms=DLM
replace;
run;
I have my libname created. But this one is not working
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.