DATA Step, Macro, Functions and more

how to use informat for a external file having 2 different format of data in same file ?

Reply
Contributor
Posts: 69

how to use informat for a external file having 2 different format of data in same file ?

Hi all, 

we have one external file in which one of numeric column has the two different type of data as shown in below :-

 

Country   Revenue 

India        2000

Nepal      2000 

USA        $2,000 

Canada  $300

AUS       $2005

 

 

how to write code for above scenario and Dataset output should look like :-

 

Country   Revenue 

India        2000

Nepal      2000 

USA        2000 

Canada  300

AUS       2005

 

PROC Star
Posts: 229

Re: how to use informat for a external file having 2 different format of data in same file ?

The COMMA. informat (alias DOLLAR.) will read values with (and without) dollar sign in front and comma as thousands separator:

data x;
  informat revenue comma.;
  input country $ revenue;
cards;
India 2000
Nepal 2000
USA $2,000
Canada $300
AUS $2005
;run;

PROC Star
Posts: 1,190

Re: how to use informat for a external file having 2 different format of data in same file ?

[ Edited ]
Ask a Question
Discussion stats
  • 2 replies
  • 49 views
  • 0 likes
  • 3 in conversation