Hi I´m trying to create a .csv without blancs in the character variables not informated, but I only arrived to obtain
xxx; ;xxxx
insted of
xxx;;xxxx (without blanks).
I´m ussing data _null_ becouse I need to write the first line with some variables and the others with other diferent variables.
Mycode is
options missing='';
data _null_;
file "/DIOGEN/REPORTINGOS/IPCA_INFOINSTAL_D_&nombre&gui&fec&csv" dlm=';';
set TmpHC.&SISTEMA;
if _n_ = 1 then /* write column names or labels */
do;
put @01 IdentificacionMensaje
VersionMensaje
TipoMensaje
TipoProceso
TipoSubproceso
IdSistema
CodificacionSistema
IdentificacionRemitente
CodificacionRemitente
FuncionRemitente
IdentificacionDestinatario
codificacionDestinatario
FuncionDestinatario
FechaHoraMensaje
Horizonte
;
end;
if _n_ >= 1 then /* write column names or labels */
do;
put @01 IdentificadorSerieTemporal
UPR
CodificacionUPR
Central
CodificacionCentral
UnidadMedida
IntervaloTiempo
Resolucion
Pos
Produccion
ConsumoPropio
Consumo
EnergiaDisponible
;
end;
run;
/
How can I do for obtain it?
Thanks
IMO the blank will not hurt at all when you read the .cvs file.
Take into account that SAS represents missing values with a . for numeric variables and with a blank for character variables.
CTorres
Why not just use the DSD option on the FILE statement? That is what it is for.
It´s a client requirement.
I said than a blank it´s not a problem but has said NO.
So, I cant put ' '
I know that with proc export there is not this problem, but i´ve the problem that i think it´s not possible to writte differtent formats for diferent rows.
So, I cant put blaknk
Sorry Tom, I dont know how to use the dsd option for that, can you explain me please?
On other hand I think they are going to use the csv to charge values into html, but the obtion of blank is not acepted.
1) read the man page.
Actually the online man page for the DSD option on the INFILE statement explains better than the section in the FILE statement.
When you specify DSD, SAS treats two consecutive delimiters as a missing value and removes quotation marks from character values.
2) try a little experiment.
data _null_;
set sashelp.class ;
if _n_=1 then age=.;
if _n_=2 then name = ' ';
file log dsd ;
put (_all_) (:);
run;
Tom, I´m looking for the utility of DSD and I´ve make a proof.
It seem to be perfect, but I would like to know exactly what is it for.
Thanks a lot!!
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.