Hello, I have a problem splitting a data set into multiple txt with title variables and data splitted by differents combinations of variables. I have this code; DATA _NULL_; SET final_7; call symput('HH',trim(left(put(H,Z2.)))); call symput('MI',trim(left(put(M,Z2.)))); call symput('SS',trim(left(put(S,Z2.)))); CALL SYMPUT("FECHAOUT",TRIM(LEFT(put(FECHA,YYMMDD6.)))); CALL SYMPUT("CCC",CAD); FILE "&OUTPATH.\HK&fechaout.&HH.&MI.&SS.&CCC..TXT"; HFIN=HORNOT+DURANOT; B='09'X; IF _N_=1 THEN PUT @1 CADENA Z4. B PROG B HORNOT TIME. B HFIN TIME. B NOTICIA; RUN; DATA _NULL_; SET final_7; call symput('HH',trim(left(put(H,Z2.)))); call symput('MI',trim(left(put(M,Z2.)))); call symput('SS',trim(left(put(S,Z2.)))); CALL SYMPUT("FECHAOUT",TRIM(LEFT(put(FECHA,YYMMDD6.)))); CALL SYMPUT("CCC",CAD); FILE "&OUTPATH.\HK&fechaout.&HH.&MI.&SS.&CCC..TXT" MOD; B='09'X; PUT @1 PATROC B HORPRE TIME. B DURPRE TIME. B MENCIO; RUN; this code writes an HK&fechaout.&HH.&MI.&SS.&CCC..TXT with the variable titles and another one with all data set without titles and without splitting. I need differents txt files including in each file the variable names: CADENA ,PROG , HORNOT , HFIN ,NOTICIA; and the data splitted by FECHAOUT , HH, MM, SS ,CCC with the data of these variables: PATROC HORPRE DURPRE MENCIO; The txt files my be like this : HK1908191630090006.txt where 190919 is fechaout, 16 is HH, 30 is MM,09 is SS,and 0006 is CCC. and data into file may be : 0001 Program 16:30:09 17:27:58 football Citroën 16:55:35 0:00:04 S Citroën 16:55:50 0:00:03 S Citroën 16:57:26 0:00:05 S Salud 17:25:11 0:00:03 S Salud 17:25:18 0:00:03 S where 0001 is CADENA, Program is PROG ,16:30:09 is HORNOT, 17:27:58 is HFIN and football is NOTICIA and the data from data set citroen is PATROC, 16:55:35 is HORPRE, 0:00:04 is DURPRE and football is MENCIO many thanks!
... View more