BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Abud
Calcite | Level 5

Hi, all

I have a text file with a field like this 00.000.000/0001-00 and I'd like to import like a number.

Question: Does anyone know how to import this kind of field ?

I mean, which kind of informat should I make to import a field with this format 00.000.000/0001-00

Is it possible make my own informat ?

tk's in advanced !!!

1 ACCEPTED SOLUTION

Accepted Solutions
Haikuo
Onyx | Level 15

I am not aware of any informat is capable of doing that, but you can always read in it as Char, process it as char, and convert it to number if needed:

data have;

  input var $50.;

  var_new=compress(var,,'kd');

  var_number=input(var_new,best32.);

  cards;

  00.000.000/0001-00

  ;

Haikuo

View solution in original post

5 REPLIES 5
DBailey
Lapis Lazuli | Level 10

What number would your example translate to?

Abud
Calcite | Level 5

Hi DBailey,

I've been importing the field like a string like "00.000.000/0001-00".

If the text data has this format "00.000.000/0001-00". How can I convert this text in a number like this 00000000000100 when I'm importing to a SAS table.

Haikuo
Onyx | Level 15

I am not aware of any informat is capable of doing that, but you can always read in it as Char, process it as char, and convert it to number if needed:

data have;

  input var $50.;

  var_new=compress(var,,'kd');

  var_number=input(var_new,best32.);

  cards;

  00.000.000/0001-00

  ;

Haikuo

DBailey
Lapis Lazuli | Level 10

If you need it to be numeric with leading zeroes, you can apply the Z14. format.

Abud
Calcite | Level 5

Tk's man!!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1178 views
  • 3 likes
  • 3 in conversation