Export SAS EG to Mysql by CSV

Asked

Viewed 111 times

0

I have a macro that exports a CSV file to Mysql. I have already run "LOAD LOCAL DATA ..." through the mysql prompt and it works perfectly.

%macro exportar_csv_mysql (host, usuario, senha, banco);

/*Cria csv da tabela SAS*/
%ds2csv (
   data=work.minha_tabela, 
   runmode=b, 
   csvfile='/dados/arquivo.csv'
 );

/*Limpa a tabela de destino*/
x /.mysql -h&host -u&usuario -p&senha -D&banco -e "TRUNCATE tb_destino";

/*Exporta o arquivo para mysql*/
x /.mysql -h&host -u&usuario -p&senha -D&banco --local-infile=1 -e  
"LOAD DATA LOCAL INFILE '/dados/arquivo.csv' 
 INTO TABLE tb_destino
 FIELDS TERMINATED BY ';' 
 LINES TERMINATED BY '\r\n' 
 IGNORE 1 LINES 
 (COLUNA_01, COLUNA_02, COLUNA_03, COLUNA_04, COLUNA_05, COLUNA_06,
 COLUNA_07, COLUNA_08, COLUNA_09, COLUNA_10, COLUNA_11, COLUNA_12, 
 COLUNA_13, COLUNA_14, COLUNA_15, COLUNA_16, COLUNA_17, COLUNA_18)";

%mend exportar_csv_mysql;

In SAS Enterprise Guide, it even creates . csv and executes "TRUNCATE", but the other party does not even execute and returns the error below. What am I doing wrong?

"WARNING 32-169: The quoted string Currently being processed has become more than 262 characters long. You may have unbalanced quotation Marks."

1 answer

1

Browser other questions tagged

You are not signed in. Login or sign up in order to post.