Hi,
I have a Z/OS Sas code with two input files and in both files I have some ZD and PD variables
@118 E5FS047_MONT_DROIT PD7.2 @119 E5FM222_MONT_DROIT_VENTIL ZD13.2 PROC SQL; CREATE TABLE CLIC_PROF AS SELECT E5FS047_ID_CLINT_USAG, E5FS047_TYP_SDU, E5FS047_SEQ_SDU, E5FS047_PER_AN, E5FS047_PER_MOIS, E5FS047_ID_INSTRC_VENTIL_5, E5FS047_TYP_ITEM_RESUL_E5, E5FS047_MONT_DROIT, E5FS047_MONT_PEINE, E5FS047_MONT_INTE_COTIS, E5FS047_MONT_INTE_DEPEN, E5FS047_MONT_INTE_CYCL, E5FS047_MONT_AUTR, E5FM222_MONT_DROIT_VENTIL, E5FM222_MONT_DECL_E5 FROM E2 INNER JOIN IV ON E2.E5FS047_ID_CLINT_USAG = IV.E5FM222_NO_USAG AND E2.E5FS047_TYP_SDU = IV.E5FM222_TYP_SDU AND E2.E5FS047_SEQ_SDU = IV.E5FM222_SEQ_SDU AND E2.E5FS047_PER_AN = IV.E5FM222_PER_AN AND E2.E5FS047_PER_MOIS = IV.E5FM222_PER_MOIS AND E2.E5FS047_ID_INSTRC_VENTIL_5 = IV.E5FM222_ID_INSTRC_VENTIL_5 WHERE E5FS047_TYP_ITEM_RESUL_E5 = 'A' AND E5FM222_MONT_DROIT_VENTIL < E5FM222_MONT_DECL_E5 ; QUIT; DATA _NULL_; SET CLIC_PROF; FILE SORTIE; PUT @001 E5FS047_ID_CLINT_USAG $CHAR10 @011 ';' @012 E5FS047_TYP_SDU $CHAR2 @014 ';' @015 E5FS047_SEQ_SDU $CHAR4 @019 ';' @020 E5FS047_PER_AN ZD4.0 @024 ';' @025 E5FS047_PER_MOIS ZD2.0 @027 ';' @028 E5FS047_ID_INSTRC_VENTIL_5 ZD9.0 @038 ';' @039 E5FS047_TYP_ITEM_RESUL_E5 $CHAR2 @041 ';' @042 E5FS047_MONT_DROIT PD7.2 @049 ';' @050 E5FS047_MONT_PEINE PD7.2 @058 ';' @059 E5FS047_MONT_INTE_COTIS PD7.2 @065 ';' @066 E5FS047_MONT_INTE_DEPEN PD7.2 @073 ';' @074 E5FS047_MONT_INTE_CYCL PD7.2 @080 ';' @081 E5FS047_MONT_AUTR PD7.2 @088 ';' @089 E5FM222_MONT_DROIT_VENTIL ZD13.2 @105 ';' @106 E5FM222_MONT_DECL_E5 ZD13.2; RUN;
The way I am doing it my output file looks like this:
1222238931;TQ;0001;201F;0B;04229918I ;A ; ä ¸; Êï)
So my question is, how can I do to convert my ZD and PD variables before PUT ?
Thank you,
Rodrigo
Use 16.2 instead of PD7.2.
With the ZDw, add 1 to the length for formats with no fractions, 2 for formats with fractions.
(ZD13.2 -> 15.2, ZD4.0 -> 5.0)
The packed decimal format is just that: a format. use any other format you want, such as 32.15, to write out the number in a human-legible form. I suspect the table's metadata may store an appropriate format for each variable.
Use 16.2 instead of PD7.2.
With the ZDw, add 1 to the length for formats with no fractions, 2 for formats with fractions.
(ZD13.2 -> 15.2, ZD4.0 -> 5.0)
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: