BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Jose7
Obsidian | Level 7

Hi experts,

I have this value  "-0000180" and i want to transform it into "000018p", where p simbolize the negative value for cobol according to this equivalents:

0=p  1=q  2=r  3=s  4=t  5=u  6=v  7=w  8=x  9=y

i have to sustitute the last digit of the negative value by the corresponding letter and keep the zeroes to the left,  examples:

-000323 = 00032s

-000567 = 00056w

Do you have any idea to do it ?

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hi @Jose7,

 

The VMSZNw.d format looks promising:

50   data _null_;
51   array x[3] (-180 -323 -567);
52   put x1 z8. +1 x1 vmszn7. /
53       x2 z7. +2 x2 vmszn6. /
54       x3 z7. +2 x3 vmszn6.;
55   run;

-0000180 000018p
-000323  00032s
-000567  00056w

View solution in original post

2 REPLIES 2
jimbarbour
Meteorite | Level 14

I don't believe you need to do it manually.  Have you looked at the S370 series of formats?  Those are intended to be used for mainframe compatible numeric formats.  I believe S370FPD would be the format you want. 

 

Also, take a look at this link:  https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/leforinforref/p17nnhja9pspodn1k6nfdop68xwk.ht... 

 

Jim

FreelanceReinh
Jade | Level 19

Hi @Jose7,

 

The VMSZNw.d format looks promising:

50   data _null_;
51   array x[3] (-180 -323 -567);
52   put x1 z8. +1 x1 vmszn7. /
53       x2 z7. +2 x2 vmszn6. /
54       x3 z7. +2 x3 vmszn6.;
55   run;

-0000180 000018p
-000323  00032s
-000567  00056w
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
  • 2 replies
  • 1086 views
  • 3 likes
  • 3 in conversation