DATA Step, Macro, Functions and more

Informat - Corporate ID

Accepted Solution Solved
Reply
Contributor
Posts: 46
Accepted Solution

Informat - Corporate ID

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 !!!


Accepted Solutions
Solution
‎03-28-2013 05:44 PM
Respected Advisor
Posts: 3,124

Re: Informat - Corporate ID

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


All Replies
Super Contributor
Posts: 578

Re: Informat - Corporate ID

What number would your example translate to?

Contributor
Posts: 46

Re: Informat - Corporate ID

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.

Solution
‎03-28-2013 05:44 PM
Respected Advisor
Posts: 3,124

Re: Informat - Corporate ID

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

Super Contributor
Posts: 578

Re: Informat  -   Corporate ID

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

Contributor
Posts: 46

Re: Informat - Corporate ID

Tk's man!!

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

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