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
SAS Super FREQ
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;

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 4488 views
  • 0 likes
  • 4 in conversation