What does your log show for this step? Best is to copy the text from the log with any notes, warning or error messages and then on the forum open a text box using the </> icon above the message window and paste all the text. The text box helps maintain formatting of any diagnostic messages that SAS provides.
@Rum wrote:
There is no error message in log ..after converting source file to dat using sas Im getting zeros on this column..
Show the code. Show the data.
If you are reading in the value from some file then try reading the set of bytes using $CHAR informat and then print them using $HEX to see what values you actually have in the file.
Then try convert those values into what you want. Read the documentation on the PD informat.
Notice the warning message:
Note: Different operating environments store packed decimal values in different ways. However, PDw.d reads packed decimal values with consistent results if the values are created in the same type of operating environment that you use to run SAS.
If the text file was made on an IBM mainframe and you are reading it on some other platform then you might need to use the S370FPD informat instead.
@Rum wrote:
i specified this as in input as @1 rec_id PD6 and at output as Z10. Both source and dat file conversion doing on mainframe not out of it that
So you seem to be saying you have program something like this:
data want;
infile myfile ;
input @1 rec_id pd6.;
format rec_id Z10.;
run;
So take a look at what is actually in the 6 bytes at the start of the record. You could use the LIST statement to have SAS dump the data to the log. You could read the value into a character string and print it with the $HEX format to see what it has. So perhaps something like this:
data want;
infile myfile ;
input @1 rec_id_hex $char6. @1 rec_id pd6.;
format rec_id Z10. rec_id_hex $hex.;
run;
Once you have some of the example values share them with us and we can help you check if they really are in PD format or not.
For example here is little program you try running to see what PD values should look like:
data test;
do integer=1 to 4000 by 500;
pd = put(integer,pd6.);
s370fpd = put(integer,s370fpd6.);
output;
end;
format pd s370fpd $hex.;
run;
Results when run on Windows.
Obs integer pd s370fpd 1 1 000000000001 00000000001C 2 501 000000000501 00000000501C 3 1001 000000001001 00000001001C 4 1501 000000001501 00000001501C 5 2001 000000002001 00000002001C 6 2501 000000002501 00000002501C 7 3001 000000003001 00000003001C 8 3501 000000003501 00000003501C
Notice how the S370FPD format has that hex digit C in the last nibble of the last byte while the PD format on Windows does not.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Lock in the best rate now before the price increases on April 1.
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.