DATA Step, Macro, Functions and more

FOR EXPOTING IN TEXT with 3 Delimiters

Accepted Solution Solved
Reply
Contributor
Posts: 66
Accepted Solution

FOR EXPOTING IN TEXT with 3 Delimiters

Hi i am having data but i wnat to export the data into text file but i want to give 3 delimeters ,how can i do it ,i have tested it but it was taking only one delimter.

proc export data=test outfile="/tmp/mydata/test.txt"

   dbms=dlm replace;

   delimiter='^?/';

run;


Accepted Solutions
Solution
‎02-09-2012 01:50 AM
Valued Guide
Posts: 634

FOR EXPOTING IN TEXT with 3 Delimiters

The DATA step can be used to write delimited files.  Consider this step as a starting point.

data _null_;

   set sashelp.class;

   file "c:\temp\test.txt"

         dlmstr='^?/';

   put name age sex height weight;

   run;

View solution in original post


All Replies
Solution
‎02-09-2012 01:50 AM
Valued Guide
Posts: 634

FOR EXPOTING IN TEXT with 3 Delimiters

The DATA step can be used to write delimited files.  Consider this step as a starting point.

data _null_;

   set sashelp.class;

   file "c:\temp\test.txt"

         dlmstr='^?/';

   put name age sex height weight;

   run;

Contributor
Posts: 66

FOR EXPOTING IN TEXT with 3 Delimiters

Thqs

Contributor
Posts: 66

FOR EXPOTING IN TEXT with 3 Delimiters

but i am not getting the variable names if i wnat the variable names what should i do i have used put also.

Valued Guide
Posts: 634

FOR EXPOTING IN TEXT with 3 Delimiters

This will add the variable names.

data _null_;

   set sashelp.class;

   file "c:\temp\test.txt"

         dlmstr='^?/';

   if _n_=1 then put 'name^?/age^?/sex^?/height^?/weight';

   put name age sex height weight;

   run;

There are DATA step solutions that do not require you to know the variable names, but they are more complicated.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 224 views
  • 0 likes
  • 2 in conversation