when we use proc export to export a as table to a certain file do we have to specify the file type?
such as;
proc export data=score.score_data (where=(gender='f'))
outfile='/folders/myfolders/Femalelist2.csv'
dbms=csv
replace;
if we remove .csv from the output file, the file can still open in excel or notepad.
this is similar to a dlm file,
proc export data=score.score_data
outfile="/folders/myfolders/sd.dat"
dbms=dlm
replace;
delimiter='&';
run;
you can remove .dat and open the output sd file with notepad.
proc export data=score.score_data
outfile='/folders/myfolders/sd_excel.xls'
dbms=XLSX replace;
sheet='data';
run;
for xlsx, it does not matter if you add .xls. the output is an excel file.
The extension used on the file is just a convention. What you NAME the file does not change the content of the file. But it does help to use the standard extensions that match the content so that others (like your Windows Operating System) have some idea what is in them.
So if you make a CSV file then use .csv as the extension on the filename.
And you are going to make an XLSX file do NOT mislabel it as an XLS file as those two file formats are different.
Excel is normally smart enough to detect the filetype when it opens the file and read it properly even if the extension on the file name does not match the content of the file. But I would be very wary of using Excel to open a CSV file as Excel will frequently change the data based on what it THINKS the character strings in the CSV file represent. So you can lose significant leading zeros off of identifers and have other strings interpreted as dates.
The extension used on the file is just a convention. What you NAME the file does not change the content of the file. But it does help to use the standard extensions that match the content so that others (like your Windows Operating System) have some idea what is in them.
So if you make a CSV file then use .csv as the extension on the filename.
And you are going to make an XLSX file do NOT mislabel it as an XLS file as those two file formats are different.
Excel is normally smart enough to detect the filetype when it opens the file and read it properly even if the extension on the file name does not match the content of the file. But I would be very wary of using Excel to open a CSV file as Excel will frequently change the data based on what it THINKS the character strings in the CSV file represent. So you can lose significant leading zeros off of identifers and have other strings interpreted as dates.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Lock in the best rate now before the price increases on April 1.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.