Hi!
I am very new to using SAS and my only reason here is because I would love to convert a ".sas7bdat" file into a ".csv" file. I have the online university version of SAS and I have upload the ".sas7bdat" file into the server. How should I write a code that transforms the SAS file into a csv so that it can be open-source format?
Thank you very much,
Sergi
If you uploaded a file (say, xxx.sas7bdat) to your "Home" folder in SAS Studio, this file resides in your personal home directory on the server.
Right-click on "Home", select Properties, and copy the path name.
Then run this:
libname home "<insert the path name here>";
proc export
data=home.xxx
file="~/xxx.csv"
dbms=csv
replace
;
run;
You should see the newly created file in your Home, from where you can download it.
If this does not work, post the complete log by copy/pasting it into a window opened with this button:
If you uploaded a file (say, xxx.sas7bdat) to your "Home" folder in SAS Studio, this file resides in your personal home directory on the server.
Right-click on "Home", select Properties, and copy the path name.
Then run this:
libname home "<insert the path name here>";
proc export
data=home.xxx
file="~/xxx.csv"
dbms=csv
replace
;
run;
You should see the newly created file in your Home, from where you can download it.
If this does not work, post the complete log by copy/pasting it into a window opened with this button:
Dear Kurt,
Unfortunately it is not working. This is the log file:
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 68 69 70 libname home "/home/u61281042/sasuser.v94; 71 72 proc export 73 data=home.epcg10 74 file="~/epcg10.csv" 75 dbms=csv 76 replace 77 ; 78 run; 79 74 file="~/epcg10.csv" _ 22 ERROR 22-7: Invalid option name ~. 80 81 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 82 ODS HTML CLOSE; 83 &GRAPHTERM; ;*';*"; ERROR: Libref HOME is not assigned. ERROR: Error in the LIBNAME statement. 83 ! */;RUN;QUIT; 84 QUIT;RUN; 85 ODS HTML5 (ID=WEB) CLOSE; 86 87 FILENAME _GSFNAME; NOTE: Fileref _GSFNAME has been deassigned. 88 DATA _NULL_; 89 RUN; NOTE: DATA statement ha utilizado (Tiempo de proceso total): real time 0.00 seconds user cpu time 0.00 seconds system cpu time 0.00 seconds memory 459.96k OS Memory 24488.00k Timestamp 07/04/2022 10:35:14 a.m. Step Count 80 Switch Count 0 Page Faults 0 Page Reclaims 24 Page Swaps 0 Voluntary Context Switches 0 Involuntary Context Switches 0 Block Input Operations 0 Block Output Operations 0 90 OPTIONS NOTES STIMER SOURCE SYNTAXCHECK; 91
Thank you very much for the help.
You seem to have had unbalanced double quotes earlier in your code.
Start a new session, and run the code there.
This
70 libname home "/home/u61281042/sasuser.v94; <=missing the closing " 71 72 proc export 73 data=home.epcg10 74 file="~/epcg10.csv" <= so on this line the first " ends the path for the LIBNAME abvoe and the ~ is treated as a LIBNAME option 75 dbms=csv 76 replace 77 ; 78 run; 79 74 file="~/epcg10.csv"
address home "<insert the path name here>";
pro export
data=home.xxx
file="~/xxx.csv"
dbms=csv
filename-dexter-.***
;
run;
ADDRESS is not a valid SAS statement, neither is PRO. Take care when you post code.
@dexcort2020 wrote:address home "<insert the path name here>"; pro export data=home.xxx file="~/xxx.csv" dbms=csv filename-dexter-.*** ; run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.