Tengo una macro en SAS que funcionaba perfectamente hasta hace unos días y me comentan en otros foros que puede ser por el puerto. SAS por defecto coge los puertos 21 y 22 y ahora deberia coger 11021 o 11022, ¿como puedo introducir en mi código el puerto?
%macro putftpfile (
server= ,/*Servidor FTP*/
user= ,/*Usuario del FTP*/
pass= ,/*Contraseña del FTP*/
path= ,/*Ruta del FTP*/
file= ,/*Nombre completo del fichero*/
inpath= /*Ruta en el servidor SAS*/
);
/* Abrimos la conexión con el FTP */
filename ftpcnx ftp "&file"
host="&server"
user="&user."
pass="&pass"
passive
cd="&path"
;
filename local "&inpath./&file";
/* Escribimos el fichero BINARIO en el la ruta FTP indicada */
data _NULL_;
infile local recfm=n;
input x $char1. @@;
file ftpcnx recfm=s;
put x $char1. @@;
run;
%mend;
%putftpfile (server=ftp.endesa.es,
user=*****,
pass=*****,
path=\STIGA\Universo_B2C,
file=Prueba_Borrar.txt,
inpath=/sasdatos/calidad/SAS/RESULTADOS/211215);
Check out the CONNPORT option on the FILENAME statement using FTP.
Just tell SAS what PORT to use by using, wait for it, the PORT= option.
filename ftpcnx ftp "&file"
host="&server"
user="&user."
pass="&pass"
passive
cd="&path"
port=11021
;
You should probably include it as a parameter to your macro.
%macro putftpfile
(server= /* Servidor FTP */
,port=21 /* FTP Port nombre */
,user= /* Usuario del FTP */
,pass= /* Contraseña del FTP */
,path= /* Ruta del FTP */
,file= /* Nombre completo del fichero */
,inpath= /* Ruta en el servidor SAS */
);
...
port=&port
...
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.