covert character 8 to integer 8

Hi,
How can i convert char 8 to integer 8 .

Thanks,
sam2929Asked:
Who is Participating?
 
Aloysius LowConnect With a Mentor Commented:
input(IND, best.)
0
 
Kevin CrossChief Technology OfficerCommented:
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.
0
 
sam2929Author Commented:
i did
input(IND,integer8.) it don't like it
0
 
Kevin CrossChief Technology OfficerCommented:
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'.
0
 
d507201Database Marketing ConsultantCommented:
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;
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.