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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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