## Extract first 8 digits left of the number

Solved
Frequent Contributor
Posts: 147

# Extract first 8 digits left of the number

Hi

I would like to pull out the first 8 digits to the left of the number........the numbers marked in yellow should be discarded.....

 295999335 295999333 295999336 295999337

Thanks

Accepted Solutions
Solution
‎08-25-2014 09:17 AM
Super User
Posts: 10,770

## Re: Extract first 8 digits left of the number

This variable is character or numeric ?Assuming it is character.

data have;

set have;

length want \$ 8;

want=variable;

run;

All Replies
Solution
‎08-25-2014 09:17 AM
Super User
Posts: 10,770

## Re: Extract first 8 digits left of the number

This variable is character or numeric ?Assuming it is character.

data have;

set have;

length want \$ 8;

want=variable;

run;

Frequent Contributor
Posts: 147

## Re: Extract first 8 digits left of the number

Thanks...Can you suggest a solution if the variable is Numeric....

Posts: 1,270

## Re: Extract first 8 digits left of the number

For numeric you can try something like this

data want;

set have;

want=int(variable/10);

run;

🔒 This topic is solved and locked.