BookmarkSubscribeRSS Feed
Sarojkumar
Calcite | Level 5
I want to create a .CSV file from SAS dataset with ';' as the separator. I tried both the folloiwng options with all the delimiters, it works fine for all other delimiters except ";"

data _null_;
set sashelp.class;
file "C:\temp\test1.csv" dsd dlm="," ;
put name sex age;
run;

and

PROC EXPORT DATA= work.saroj
OUTFILE= "C:\temp\test1.csv"
DBMS=CSV REPLACE;
delimeter = '|';
RUN;


My output should be the following with ; as the separator.

Alfred;M;14
Alice;F;13
Barbara;F;13
Carol;F;14
Henry;M;14

But the above values are displayed in separate columns as

Alfred M 14
Alice F 13
Barbara F 13
Carol F 14
Henry M 14
James M 12
Jane F 12
Janet F 15

Any help on this.
3 REPLIES 3
Cynthia_sas
Diamond | Level 26
Hi:
Using ODS CSV and PROC PRINT, you can get the ';' as a delimiter. There have been previous forum postings on this topic:
http://support.sas.com/forums/thread.jspa?messageID=29025煡
http://support.sas.com/forums/thread.jspa?threadID=5414
http://support.sas.com/forums/thread.jspa?messageID=19459䰃


cynthia
Peter_C
Rhodochrosite | Level 12
Sarojkumar

Which release of SAS are you using?
In the data step, why not set dlm= ";" ?
It works for me!

In the proc export code, why use '|' when you want ';' ?

If it's not working, show us your log!

hth
peterC
deleted_user
Not applicable
i agree with peterc.

here is the code: (there was syntax error with proc export)

data _null_;
set sashelp.class;
file "C:\temp\test1.csv" dsd dlm=";" ;
put name sex age;
run;

PROC EXPORT DATA= sashelp.class
OUTFILE= "C:\temp\test1.csv"
DBMS=CSV REPLACE ;
delimiter = ';';
RUN;

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 5409 views
  • 0 likes
  • 4 in conversation