Hello
I have a problem - when I try to export a dataset to delimited txt file using data step export, I experience a small but annoying issue that is probably limited to this way of exporting a file because proc export does the job just fine. Unfortunately I need to provide changes to this txt file that proc export can't do so using it is not the solution. So... the thing is - I have in my dataset columns that are always filled with some data and some that are not and in the txt file these empty cells look like this:
, ,
What I want is ,,. How can I remove this blank space betweem delimiter?
I believe you're looking for "DSD".
ods _all_ close;
ods listing;
options missing='';
data _null_;
set sashelp.class;
file print delimiter=',' DSD;
if _n_=2 then call missing(Sex,Age,Name);
put Height Sex Age Name Weight;
run;
It would really help if you would post your code - especially the bit where you're actually writing to the text file.
So just purely guessing here:
You might be looking for something like PUT VAR1 +(-1) ',' VAR2 .....;
My code:
data _null_ ;
set WORK.Files;
file outfile delimiter=',';
if _n_ = 1 then do;
PUT 'A,B,C,D';
end;
PUT A B C D;
run ;
The output is:
A~B~C~D
F1,235, ,
What I want is:
A~B~C~D
F1,235,,,
I believe you're looking for "DSD".
ods _all_ close;
ods listing;
options missing='';
data _null_;
set sashelp.class;
file print delimiter=',' DSD;
if _n_=2 then call missing(Sex,Age,Name);
put Height Sex Age Name Weight;
run;
That's it! Thank you!
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.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.