covert character 8 to integer 8

sam2929
sam2929 used Ask the Experts™
on
Hi,
How can i convert char 8 to integer 8 .

Thanks,
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Kevin CrossChief Technology Officer
Most Valuable Expert 2011

Commented:
Here is an option if I am understanding documentation correctly: use INPUT to go from character to integer and PUT to go from integer to character.

Author

Commented:
i did
input(IND,integer8.) it don't like it
input(IND, best.)
Kevin CrossChief Technology Officer
Most Valuable Expert 2011

Commented:
Did you look at the link I provided? I don't believe integer8. is a proper informat. I think it is just 8.
http://support.sas.com/publishing/pubcat/chaps/59498.pdf

try:
input(IND, 8.)

Open in new window

or
input(IND, comma8.)

Open in new window

(latter is used when you need to strip commas from a string like '1,000'.
d507201Database Marketing Consultant

Commented:
This code works just fine.  MWVISA1 is correct... the proper informat is 8. not integer8.  If the length of your character variable is varying then use the BEST. informat instead of 8.  SAS will always store the numbers in 8 bytes but numbers bigger than I think 14 digits will be stored in scientific notation and so lose precision when retrieved.

data charData;
char='12345678';
run;

Data numData; set charData;
num=input(char,8.);
put _all_;
run;

proc contents data=numData;
run;

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial