Help using Base SAS procedures

format command

Reply
Occasional Contributor
Posts: 9

format command

Hi,

On running format command i am getting an error "

ERROR: You are trying to use the numeric format AGE_FMT with the character variable Age in data

  set CDRIVE.BANK_DATA2."

Below is the code i am trying to execute:

title 'Decision by Age';

proc freq data=&hmda_file order=freq;

format age age_fmt. action status_fmt.;  table age * action / missing nocum nopercent nocol; run;

Kindly help.!

Thanks in advance.

Valued Guide
Posts: 860

Re: format command

You provide the answer in your question.

You are using a numeric format (age_fmt.) for a character variable (age).

You can either remove age age_fmt. from the format command or before this step change the character age to numeric age.

data have;

infile cards dsd;

input age $;

cards;

8

;

run;

data want(rename=(age_2=age));

set have;

age_2 = input(age,8.);

drop age;

run;

Occasional Contributor
Posts: 9

Re: format command

Posted in reply to Steelers_In_DC

Hi Mark,

Thanks for your help, You are a savior i got it right.

Thanks.

Ask a Question
Discussion stats
  • 2 replies
  • 223 views
  • 0 likes
  • 2 in conversation