BookmarkSubscribeRSS Feed
T1n21
Calcite | Level 5

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);

3 REPLIES 3
T1n21
Calcite | Level 5
I have a macro in SAS that worked perfectly until a few days ago and I have been told in other forums that it may be because of the port. SAS by default takes ports 21 and 22 and now it should take 11021 or 11022, how can I enter the port in my code?
SASKiwi
PROC Star

Check out the CONNPORT option on the FILENAME statement using FTP.

Tom
Super User Tom
Super User

Just tell SAS what PORT to use by using, wait for it, the PORT= option.

https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsglobal/p0v0ijxl1k6d4bn16cshtic7u4i3...

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
...

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1268 views
  • 0 likes
  • 3 in conversation