Help using Base SAS procedures

format issue

Reply
Super Contributor
Posts: 256

format issue

When I run this, the format for field1 should be 12,346,756 but it's 12346756

data test;

   infile datalines DLM = ',';

   input

  field1      : comma10.0

  lossyr                   : 20.

;

 

  DATALINES ;

12346756,2014

;


Super User
Posts: 6,928

Re: format issue

Correct my previous version of this post.

You are only _using_ an ínformat, but you have not assigned any display format.

Add

format

  field1  comma10.0

  lossyr  20.

;

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Super Contributor
Posts: 490

Re: format issue

data test;

   infile datalines DLM = ',';

format field1 COMMA10. lossyr 20.;

input field1 lossyr;

DATALINES ;

12346756,2014

;

run;

Super User
Super User
Posts: 7,392

Re: format issue

Yes, you have read the data in as comma10.0, i.e. the input reads the data in that format, buy you have not applied a format to the variable.

data test;

   infile datalines DLM = ',';

   input

  field1 : comma10.0

  lossyr : 20.;

  format field1 comma10.0;

  DATALINES ;

12346756,2014

;

run;

Ask a Question
Discussion stats
  • 3 replies
  • 190 views
  • 0 likes
  • 4 in conversation