Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 346
  • Last Modified:

covert character 8 to integer 8

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

Thanks,
0
sam2929
Asked:
sam2929
1 Solution
 
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
 
Aloysius LowCommented:
input(IND, best.)
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

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now